+ }
+
+ getAMPMSelect() {
+ const { prefixCls, use12Hours, format } = this.props;
+ if (!use12Hours) {
+ return null;
+ }
+
+ const AMPMOptions = ['am', 'pm'] // If format has A char, then we should uppercase AM/PM
+ .map(c => format.match(/\sA/) ? c.toUpperCase() : c)
+ .map(c => ({ value: c }));
+
+ const selected = this.isAM() ? 0 : 1;
+
+ return (
+ <Select
+ prefixCls={prefixCls}
+ options={AMPMOptions}
+ selectedIndex={selected}
+ type="ampm"
+ onSelect={this.onItemChange}
+ onMouseEnter={this.onEnterSelectPanel.bind(this, 'ampm')}
+ />
+ );
+ }
+
+ isAM() {
+ const value = (this.props.value || this.props.defaultOpenValue);
+ return value.hour() >= 0 && value.hour() < 12;
+ }