},
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' : '',
prefixCls, placeholder, placement, align,
disabled, transitionName, style, className, showHour,
showMinute, showSecond, getPopupContainer, name, autoComplete,
+ use12Hours,
} = this.props;
const { open, value } = this.state;
let popupClassName;
- if (!showHour || !showMinute || !showSecond) {
+ if ((!showHour || !showMinute || !showSecond) && !use12Hours) {
popupClassName = `${prefixCls}-panel-narrow`;
}
return (