diff options
author | Antony Shaleynikov <shaleynikov@gmail.com> | 2017-03-02 16:36:33 +0300 |
---|---|---|
committer | Antony Shaleynikov <shaleynikov@gmail.com> | 2017-03-02 16:36:33 +0300 |
commit | 2a8cf5ae98a8b827e62aa20212053de6171315c9 (patch) | |
tree | 2b79ca90a76a49cb6861614d6765309c0a219429 | |
parent | 79405d1bc30c868cdf2c4bfb3abe654d28aeb5ca (diff) | |
download | time-picker-2a8cf5ae98a8b827e62aa20212053de6171315c9.tar.gz time-picker-2a8cf5ae98a8b827e62aa20212053de6171315c9.tar.zst time-picker-2a8cf5ae98a8b827e62aa20212053de6171315c9.zip |
Tests and 12PM -> 12AM switching fixed
-rw-r--r-- | src/Combobox.jsx | 9 | ||||
-rw-r--r-- | tests/Select.spec.jsx | 2 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/Combobox.jsx b/src/Combobox.jsx index d2c934c..958e108 100644 --- a/src/Combobox.jsx +++ b/src/Combobox.jsx | |||
@@ -56,15 +56,12 @@ const Combobox = React.createClass({ | |||
56 | value.minute(+itemValue); | 56 | value.minute(+itemValue); |
57 | } else if (type === 'ampm') { | 57 | } else if (type === 'ampm') { |
58 | if (use12Hours) { | 58 | if (use12Hours) { |
59 | if (itemValue === 'PM' && value.hour() <= 12) { | 59 | if (itemValue === 'PM' && value.hour() < 12) { |
60 | value.hour(value.hour() + 12); | 60 | value.hour((value.hour() % 12) + 12); |
61 | } | 61 | } |
62 | 62 | ||
63 | if (itemValue === 'AM') { | 63 | if (itemValue === 'AM') { |
64 | if (!value.hour()) { | 64 | if (value.hour() >= 12) { |
65 | value.hour(12); | ||
66 | } else | ||
67 | if (value.hour() > 12) { | ||
68 | value.hour(value.hour() - 12); | 65 | value.hour(value.hour() - 12); |
69 | } | 66 | } |
70 | } | 67 | } |
diff --git a/tests/Select.spec.jsx b/tests/Select.spec.jsx index fb58145..ea0a827 100644 --- a/tests/Select.spec.jsx +++ b/tests/Select.spec.jsx | |||
@@ -446,7 +446,7 @@ describe('Select', () => { | |||
446 | Simulate.click(selector.getElementsByTagName('li')[0]); | 446 | Simulate.click(selector.getElementsByTagName('li')[0]); |
447 | setTimeout(next, 200); | 447 | setTimeout(next, 200); |
448 | }, (next) => { | 448 | }, (next) => { |
449 | expect((input).value).to.be('12:00 pm'); | 449 | expect((input).value).to.be('12:00 am'); |
450 | next(); | 450 | next(); |
451 | }], () => { | 451 | }], () => { |
452 | done(); | 452 | done(); |