mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
fix dateInput format when contains time-picker, close #953
This commit is contained in:
parent
4fb1e60c02
commit
21eac259b6
@ -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];
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
- order: 4
|
- order: 4
|
||||||
- hidden: true
|
- hidden: true
|
||||||
|
|
||||||
和 [时间选择框](/components/timepicer) 配合使用。
|
和 [时间选择框](/components/time-picker) 配合使用。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -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}
|
||||||
|
Loading…
Reference in New Issue
Block a user