]> git.immae.eu Git - github/fretlink/time-picker.git/blobdiff - src/Combobox.jsx
Fixes #75: Disabled Hours for 12 hour picker
[github/fretlink/time-picker.git] / 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;