]> git.immae.eu Git - github/fretlink/time-picker.git/blobdiff - src/Combobox.jsx
Tests and 12PM -> 12AM switching fixed
[github/fretlink/time-picker.git] / src / Combobox.jsx
index d2c934c5388d30168db3e882c9e8f35957cb7bc5..958e108baef5e3bcd08a61e9349abc4014411299 100644 (file)
@@ -56,15 +56,12 @@ const Combobox = React.createClass({
       value.minute(+itemValue);
     } else if (type === 'ampm') {
       if (use12Hours) {
-        if (itemValue === 'PM' && value.hour() <= 12) {
-          value.hour(value.hour() + 12);
+        if (itemValue === 'PM' && value.hour() < 12) {
+          value.hour((value.hour() % 12) + 12);
         }
 
         if (itemValue === 'AM') {
-          if (!value.hour()) {
-            value.hour(12);
-          } else
-          if (value.hour() > 12) {
+          if (value.hour() >= 12) {
             value.hour(value.hour() - 12);
           }
         }