aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorVahagn Aharonian <vahagn.aharonian@gmail.com>2018-02-01 12:50:34 +0400
committerVahagn Aharonian <vahagn.aharonian@gmail.com>2018-02-01 12:50:34 +0400
commitab128c3d1cf22599a20de85ca103f1d38d280848 (patch)
tree323906260eb7480d9e1fecdb2d36bd955d482bba /src
parentf30361fe767d300312c3d1467a60462d9f7da059 (diff)
downloadtime-picker-ab128c3d1cf22599a20de85ca103f1d38d280848.tar.gz
time-picker-ab128c3d1cf22599a20de85ca103f1d38d280848.tar.zst
time-picker-ab128c3d1cf22599a20de85ca103f1d38d280848.zip
Add tests; fix the logic
Diffstat (limited to 'src')
-rw-r--r--src/Combobox.jsx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Combobox.jsx b/src/Combobox.jsx
index 18fd54c..19fbd19 100644
--- a/src/Combobox.jsx
+++ b/src/Combobox.jsx
@@ -90,8 +90,12 @@ class Combobox extends Component {
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 92
93 if (!this.isAM() && Array.isArray(disabledOptions)) { 93 if (Array.isArray(disabledOptions)) {
94 disabledOptions = disabledOptions.map(h => h - 12); 94 if (this.isAM()) {
95 disabledOptions = disabledOptions.filter(h => h < 12).map(h => (h === 0 ? 12 : h));
96 } else {
97 disabledOptions = disabledOptions.map(h => (h === 12 ? 12 : h - 12));
98 }
95 } 99 }
96 } else { 100 } else {
97 hourOptionsAdj = hourOptions; 101 hourOptionsAdj = hourOptions;