From ab128c3d1cf22599a20de85ca103f1d38d280848 Mon Sep 17 00:00:00 2001 From: Vahagn Aharonian Date: Thu, 1 Feb 2018 12:50:34 +0400 Subject: Add tests; fix the logic --- src/Combobox.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') 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 { 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); + if (Array.isArray(disabledOptions)) { + if (this.isAM()) { + disabledOptions = disabledOptions.filter(h => h < 12).map(h => (h === 0 ? 12 : h)); + } else { + disabledOptions = disabledOptions.map(h => (h === 12 ? 12 : h - 12)); + } } } else { hourOptionsAdj = hourOptions; -- cgit v1.2.3