aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/TimePicker.jsx
diff options
context:
space:
mode:
authorAntony Shaleynikov <shaleynikov@gmail.com>2017-03-02 15:42:05 +0300
committerAntony Shaleynikov <shaleynikov@gmail.com>2017-03-02 15:42:05 +0300
commitdd2f6abda00cea99ec0a24e3f162fabeba7ac176 (patch)
tree770b27246656d47c5308894919238238c0dc4d6d /src/TimePicker.jsx
parentdd275f7df354e218d170ddbcc1eadff1427db76b (diff)
downloadtime-picker-dd2f6abda00cea99ec0a24e3f162fabeba7ac176.tar.gz
time-picker-dd2f6abda00cea99ec0a24e3f162fabeba7ac176.tar.zst
time-picker-dd2f6abda00cea99ec0a24e3f162fabeba7ac176.zip
Updated 12 hours example, added default format for 12 hours mode, updated tests
Diffstat (limited to 'src/TimePicker.jsx')
-rw-r--r--src/TimePicker.jsx13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx
index 6b76223..7065333 100644
--- a/src/TimePicker.jsx
+++ b/src/TimePicker.jsx
@@ -128,10 +128,21 @@ const Picker = React.createClass({
128 }, 128 },
129 129
130 getFormat() { 130 getFormat() {
131 const { format, showHour, showMinute, showSecond } = this.props; 131 const { format, showHour, showMinute, showSecond, use12Hours } = this.props;
132 if (format) { 132 if (format) {
133 return format; 133 return format;
134 } 134 }
135
136 if (use12Hours) {
137 const fmtString = ([
138 showHour ? 'h' : '',
139 showMinute ? 'mm' : '',
140 showSecond ? 'ss' : '',
141 ].filter(item => !!item).join(':'));
142
143 return fmtString.concat(' a');
144 }
145
135 return [ 146 return [
136 showHour ? 'HH' : '', 147 showHour ? 'HH' : '',
137 showMinute ? 'mm' : '', 148 showMinute ? 'mm' : '',