From: Vahagn Aharonian Date: Sat, 2 Dec 2017 15:33:34 +0000 (+0400) Subject: Fixes #75: Disabled Hours for 12 hour picker X-Git-Tag: 3.3.1~3^2~1 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=f30361fe767d300312c3d1467a60462d9f7da059;p=github%2Ffretlink%2Ftime-picker.git Fixes #75: Disabled Hours for 12 hour picker --- diff --git a/src/Combobox.jsx b/src/Combobox.jsx index 1eed4d2..18fd54c 100644 --- a/src/Combobox.jsx +++ b/src/Combobox.jsx @@ -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;