diff options
author | Vahagn Aharonian <vahagn.aharonian@gmail.com> | 2017-12-02 19:33:34 +0400 |
---|---|---|
committer | Vahagn Aharonian <vahagn.aharonian@gmail.com> | 2017-12-02 19:45:53 +0400 |
commit | f30361fe767d300312c3d1467a60462d9f7da059 (patch) | |
tree | 3a69dca1d08ad6e929cd172dda4667fc001be45e | |
parent | 73a24157501c8d75aac94b3f6c913c754d46e94f (diff) | |
download | time-picker-f30361fe767d300312c3d1467a60462d9f7da059.tar.gz time-picker-f30361fe767d300312c3d1467a60462d9f7da059.tar.zst time-picker-f30361fe767d300312c3d1467a60462d9f7da059.zip |
Fixes #75: Disabled Hours for 12 hour picker
-rw-r--r-- | src/Combobox.jsx | 6 |
1 files changed, 5 insertions, 1 deletions
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 { | |||
83 | if (!showHour) { | 83 | if (!showHour) { |
84 | return null; | 84 | return null; |
85 | } | 85 | } |
86 | const disabledOptions = disabledHours(); | 86 | let disabledOptions = disabledHours(); |
87 | let hourOptionsAdj; | 87 | let hourOptionsAdj; |
88 | let hourAdj; | 88 | let hourAdj; |
89 | if (use12Hours) { | 89 | if (use12Hours) { |
90 | hourOptionsAdj = [12].concat(hourOptions.filter(h => h < 12 && h > 0)); | 90 | hourOptionsAdj = [12].concat(hourOptions.filter(h => h < 12 && h > 0)); |
91 | hourAdj = (hour % 12) || 12; | 91 | hourAdj = (hour % 12) || 12; |
92 | |||
93 | if (!this.isAM() && Array.isArray(disabledOptions)) { | ||
94 | disabledOptions = disabledOptions.map(h => h - 12); | ||
95 | } | ||
92 | } else { | 96 | } else { |
93 | hourOptionsAdj = hourOptions; | 97 | hourOptionsAdj = hourOptions; |
94 | hourAdj = hour; | 98 | hourAdj = hour; |