Browse Source

fix dateInput format when contains time-picker, close #953

pull/957/head
afc163 9 years ago
parent
commit
21eac259b6
  1. 6
      components/date-picker/PickerMixin.jsx
  2. 2
      components/date-picker/demo/with-time-picker.md
  3. 3
      components/date-picker/index.jsx

6
components/date-picker/PickerMixin.jsx

@ -13,7 +13,11 @@ export default {
getFormatter() {
const formats = this.formats = this.formats || {};
const format = this.props.format;
let format = this.props.format;
// Remove time format text when has time-picker in calendar
if (this.props.showTime) {
format = format.replace('HH:mm:ss', '');
}
if (formats[format]) {
return formats[format];
}

2
components/date-picker/demo/with-time-picker.md

@ -3,7 +3,7 @@
- order: 4
- hidden: true
和 [时间选择框](/components/timepicer) 配合使用。
和 [时间选择框](/components/time-picker) 配合使用。
---

3
components/date-picker/index.jsx

@ -62,6 +62,8 @@ function createPicker(TheCalendar, defaultFormat) {
transitionName="slide-up" />
: null;
const disabledTime = this.props.showTime ? this.props.disabledTime : null;
const calendarClassName = classNames({
['ant-calendar-time']: this.props.showTime,
['ant-calendar-month']: MonthCalendar === TheCalendar,
@ -71,6 +73,7 @@ function createPicker(TheCalendar, defaultFormat) {
<TheCalendar
formatter={this.getFormatter()}
disabledDate={this.props.disabledDate}
disabledTime={disabledTime}
locale={locale.lang}
timePicker={timePicker}
defaultValue={defaultCalendarValue}

Loading…
Cancel
Save