From 95699887ac75de5dff6bd25278289e31e4745482 Mon Sep 17 00:00:00 2001
From: Antony Shaleynikov <shaleynikov@gmail.com>
Date: Wed, 1 Mar 2017 23:58:06 +0300
Subject: Added 12hours display support

---
 src/TimePicker.jsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/TimePicker.jsx')

diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx
index e9d6d15..f73d2b1 100644
--- a/src/TimePicker.jsx
+++ b/src/TimePicker.jsx
@@ -43,6 +43,7 @@ const Picker = React.createClass({
     addon: PropTypes.func,
     name: PropTypes.string,
     autoComplete: PropTypes.string,
+    show12Hours: PropTypes.bool,
   },
 
   getDefaultProps() {
@@ -67,6 +68,7 @@ const Picker = React.createClass({
       onOpen: noop,
       onClose: noop,
       addon: noop,
+      show12Hours: false,
     };
   },
 
@@ -142,7 +144,7 @@ const Picker = React.createClass({
       prefixCls, placeholder, disabledHours,
       disabledMinutes, disabledSeconds, hideDisabledOptions,
       allowEmpty, showHour, showMinute, showSecond, defaultOpenValue, clearText,
-      addon,
+      addon, show12Hours,
     } = this.props;
     return (
       <Panel
@@ -164,6 +166,7 @@ const Picker = React.createClass({
         disabledMinutes={disabledMinutes}
         disabledSeconds={disabledSeconds}
         hideDisabledOptions={hideDisabledOptions}
+        show12Hours={show12Hours}
         addon={addon}
       />
     );
-- 
cgit v1.2.3


From dd275f7df354e218d170ddbcc1eadff1427db76b Mon Sep 17 00:00:00 2001
From: Antony Shaleynikov <shaleynikov@gmail.com>
Date: Thu, 2 Mar 2017 11:02:45 +0300
Subject: show12Hours prop was renamed to use12Hours

---
 src/TimePicker.jsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/TimePicker.jsx')

diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx
index f73d2b1..6b76223 100644
--- a/src/TimePicker.jsx
+++ b/src/TimePicker.jsx
@@ -43,7 +43,7 @@ const Picker = React.createClass({
     addon: PropTypes.func,
     name: PropTypes.string,
     autoComplete: PropTypes.string,
-    show12Hours: PropTypes.bool,
+    use12Hours: PropTypes.bool,
   },
 
   getDefaultProps() {
@@ -68,7 +68,7 @@ const Picker = React.createClass({
       onOpen: noop,
       onClose: noop,
       addon: noop,
-      show12Hours: false,
+      use12Hours: false,
     };
   },
 
@@ -144,7 +144,7 @@ const Picker = React.createClass({
       prefixCls, placeholder, disabledHours,
       disabledMinutes, disabledSeconds, hideDisabledOptions,
       allowEmpty, showHour, showMinute, showSecond, defaultOpenValue, clearText,
-      addon, show12Hours,
+      addon, use12Hours,
     } = this.props;
     return (
       <Panel
@@ -166,7 +166,7 @@ const Picker = React.createClass({
         disabledMinutes={disabledMinutes}
         disabledSeconds={disabledSeconds}
         hideDisabledOptions={hideDisabledOptions}
-        show12Hours={show12Hours}
+        use12Hours={use12Hours}
         addon={addon}
       />
     );
-- 
cgit v1.2.3


From dd2f6abda00cea99ec0a24e3f162fabeba7ac176 Mon Sep 17 00:00:00 2001
From: Antony Shaleynikov <shaleynikov@gmail.com>
Date: Thu, 2 Mar 2017 15:42:05 +0300
Subject: Updated 12 hours example, added default format for 12 hours mode,
 updated tests

---
 src/TimePicker.jsx | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'src/TimePicker.jsx')

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({
   },
 
   getFormat() {
-    const { format, showHour, showMinute, showSecond } = this.props;
+    const { format, showHour, showMinute, showSecond, use12Hours } = this.props;
     if (format) {
       return format;
     }
+
+    if (use12Hours) {
+      const fmtString = ([
+        showHour ? 'h' : '',
+        showMinute ? 'mm' : '',
+        showSecond ? 'ss' : '',
+      ].filter(item => !!item).join(':'));
+
+      return fmtString.concat(' a');
+    }
+
     return [
       showHour ? 'HH' : '',
       showMinute ? 'mm' : '',
-- 
cgit v1.2.3

