diff options
author | Antony Shaleynikov <shaleynikov@gmail.com> | 2017-03-06 12:51:39 +0300 |
---|---|---|
committer | Antony Shaleynikov <shaleynikov@gmail.com> | 2017-03-06 12:51:39 +0300 |
commit | eb3c19e2cd2e11cec1eed9337ce44a312b3fc60b (patch) | |
tree | 33e9bfb75a5ed12629d85cc8095030b8f21db1e9 /src/Combobox.jsx | |
parent | 2a8cf5ae98a8b827e62aa20212053de6171315c9 (diff) | |
download | time-picker-eb3c19e2cd2e11cec1eed9337ce44a312b3fc60b.tar.gz time-picker-eb3c19e2cd2e11cec1eed9337ce44a312b3fc60b.tar.zst time-picker-eb3c19e2cd2e11cec1eed9337ce44a312b3fc60b.zip |
Added support for lower/uppercase of AM/PM selectors
Diffstat (limited to 'src/Combobox.jsx')
-rw-r--r-- | src/Combobox.jsx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Combobox.jsx b/src/Combobox.jsx index 958e108..00f122f 100644 --- a/src/Combobox.jsx +++ b/src/Combobox.jsx | |||
@@ -145,11 +145,15 @@ const Combobox = React.createClass({ | |||
145 | }, | 145 | }, |
146 | 146 | ||
147 | getAMPMSelect() { | 147 | getAMPMSelect() { |
148 | const { prefixCls, use12Hours } = this.props; | 148 | const { prefixCls, use12Hours, format } = this.props; |
149 | if (!use12Hours) { | 149 | if (!use12Hours) { |
150 | return null; | 150 | return null; |
151 | } | 151 | } |
152 | const AMPMOptions = [{ value: 'AM' }, { value: 'PM' }]; | 152 | |
153 | const AMPMOptions = ['am', 'pm'] // If format has A char, then we should uppercase AM/PM | ||
154 | .map(c => format.match(/\sA/) ? c.toUpperCase() : c) | ||
155 | .map(c => ({ value: c })); | ||
156 | |||
153 | const selected = this.isAM() ? 0 : 1; | 157 | const selected = this.isAM() ? 0 : 1; |
154 | 158 | ||
155 | return ( | 159 | return ( |