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

This commit is contained in:
afc163 2016-01-30 16:15:43 +08:00
parent 4fb1e60c02
commit 21eac259b6
3 changed files with 9 additions and 2 deletions

View File

@ -13,7 +13,11 @@ export default {
getFormatter() { getFormatter() {
const formats = this.formats = this.formats || {}; 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]) { if (formats[format]) {
return formats[format]; return formats[format];
} }

View File

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

View File

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