]> git.immae.eu Git - github/fretlink/time-picker.git/commitdiff
Fixes #75: Disabled Hours for 12 hour picker
authorVahagn Aharonian <vahagn.aharonian@gmail.com>
Sat, 2 Dec 2017 15:33:34 +0000 (19:33 +0400)
committerVahagn Aharonian <vahagn.aharonian@gmail.com>
Sat, 2 Dec 2017 15:45:53 +0000 (19:45 +0400)
src/Combobox.jsx

index 1eed4d295e90efabb1400cb869ec19aa8db4f87f..18fd54c317c1fe64384dfe5406e9063c35b6d297 100644 (file)
@@ -83,12 +83,16 @@ class Combobox extends Component {
     if (!showHour) {
       return null;
     }
-    const disabledOptions = disabledHours();
+    let disabledOptions = disabledHours();
     let hourOptionsAdj;
     let hourAdj;
     if (use12Hours) {
       hourOptionsAdj = [12].concat(hourOptions.filter(h => h < 12 && h > 0));
       hourAdj = (hour % 12) || 12;
+
+      if (!this.isAM() && Array.isArray(disabledOptions)) {
+        disabledOptions = disabledOptions.map(h => h - 12);
+      }
     } else {
       hourOptionsAdj = hourOptions;
       hourAdj = hour;