aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorWei Zhu <yesmeck@gmail.com>2018-02-22 16:13:42 +0800
committerGitHub <noreply@github.com>2018-02-22 16:13:42 +0800
commitcd8d3e48c8a56e2f60405029cc1169d791e18cca (patch)
tree623493a0e5f424f84e2c0bfd1e4f05297bbea0c0 /src
parentd408a2b14c21e360dfcea2fc59810ec0fe4d3eee (diff)
parentab128c3d1cf22599a20de85ca103f1d38d280848 (diff)
downloadtime-picker-cd8d3e48c8a56e2f60405029cc1169d791e18cca.tar.gz
time-picker-cd8d3e48c8a56e2f60405029cc1169d791e18cca.tar.zst
time-picker-cd8d3e48c8a56e2f60405029cc1169d791e18cca.zip
Merge pull request #87 from vahnag/master
Fixes #75: Disabled Hours for 12 hour picker
Diffstat (limited to 'src')
-rw-r--r--src/Combobox.jsx10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Combobox.jsx b/src/Combobox.jsx
index 1eed4d2..19fbd19 100644
--- a/src/Combobox.jsx
+++ b/src/Combobox.jsx
@@ -83,12 +83,20 @@ 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 (Array.isArray(disabledOptions)) {
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 }
99 }
92 } else { 100 } else {
93 hourOptionsAdj = hourOptions; 101 hourOptionsAdj = hourOptions;
94 hourAdj = hour; 102 hourAdj = hour;