Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ada2c55

Browse files
committedApr 5, 2020
Fix broken time parsing regex
Fix #712 and fix #713
1 parent c59d93a commit ada2c55

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed
 

‎__tests__/timepicker-test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ test("show single string noneOption correctly", () =>{
2323

2424
expect($(`#${TEST_INPUT}`).val()).toEqual('');
2525
});
26+
27+
test("timepicker can parse time value", () => {
28+
$(`#${TEST_INPUT}`).val('2:37pm');
29+
$(`#${TEST_INPUT}`).timepicker();
30+
31+
expectedSecondsFromMidnight = 14 * 3600 + 37 * 60;
32+
expect($(`#${TEST_INPUT}`).timepicker('getSecondsFromMidnight')).toEqual(expectedSecondsFromMidnight);
33+
});

‎bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jt.timepicker",
3-
"version": "1.13.3",
3+
"version": "1.13.4",
44
"description": "A jQuery timepicker plugin inspired by Google Calendar.",
55
"homepage": "http://jonthornton.github.com/jquery-timepicker",
66
"main": ["./jquery.timepicker.js", "./jquery.timepicker.css"],

‎jquery.timepicker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jquery-timepicker v1.13.3 - A jQuery timepicker plugin inspired by Google Calendar. It supports both mouse and keyboard navigation.
2+
* jquery-timepicker v1.13.4 - A jQuery timepicker plugin inspired by Google Calendar. It supports both mouse and keyboard navigation.
33
* Copyright (c) 2015 Jon Thornton - http://jonthornton.github.com/jquery-timepicker/
44
* License: MIT
55
*/
@@ -1245,7 +1245,7 @@
12451245
timeString += "m";
12461246
}
12471247

1248-
var pattern = /^(([^0-9]*))?([0-9]?[0-9])(\\W?([0-5][0-9]))?(\\W+([0-5][0-9]))?(([^0-9]*))$/;
1248+
var pattern = /^(([^0-9]*))?([0-9]?[0-9])(\W?([0-5][0-9]))?(\W+([0-5][0-9]))?(([^0-9]*))$/;
12491249
var time = timeString.match(pattern);
12501250
if (!time) {
12511251
return null;

‎jquery.timepicker.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "timepicker",
3-
"version": "1.13.3",
3+
"version": "1.13.4",
44
"title": "jquery-timepicker",
55
"author": {
66
"name": "Jon Thornton",

0 commit comments

Comments
 (0)
Please sign in to comment.