mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
fix: should use moment.isMoment, close: #4147
This commit is contained in:
parent
883066820a
commit
273faafaa2
@ -65,7 +65,7 @@ export default class Calendar extends React.Component<CalendarProps, any> {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const value = props.value || props.defaultValue || moment();
|
||||
if (!(value instanceof moment)) {
|
||||
if (!moment.isMoment(value)) {
|
||||
throw new Error(
|
||||
'The value/defaultValue of Calendar must be a moment object after `antd@2.0`, ' +
|
||||
'see: http://u.ant.design/calendar-value'
|
||||
|
@ -16,8 +16,8 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
super(props);
|
||||
const value = props.value || props.defaultValue || [];
|
||||
if (
|
||||
value[0] && !(value[0] instanceof moment) ||
|
||||
value[1] && !(value[1] instanceof moment)
|
||||
value[0] && !moment.isMoment(value[0]) ||
|
||||
value[1] && !moment.isMoment(value[1])
|
||||
) {
|
||||
throw new Error(
|
||||
'The value/defaultValue of RangePicker must be a moment object array after `antd@2.0`, ' +
|
||||
|
@ -64,7 +64,7 @@ export default class TimePicker extends React.Component<TimePickerProps, any> {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const value = props.value || props.defaultValue;
|
||||
if (value && !(value instanceof moment)) {
|
||||
if (value && !moment.isMoment(value)) {
|
||||
throw new Error(
|
||||
'The value/defaultValue of TimePicker must be a moment object after `antd@2.0`, ' +
|
||||
'see: http://u.ant.design/time-picker-value'
|
||||
|
Loading…
Reference in New Issue
Block a user