Skip to content

Commit

Permalink
fix: should use moment.isMoment, close: #4147
Browse files Browse the repository at this point in the history
  • Loading branch information
benjycui committed Dec 6, 2016
1 parent 8830668 commit 273faaf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/calendar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions components/date-picker/RangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`, ' +
Expand Down
2 changes: 1 addition & 1 deletion components/time-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

3 comments on commit 273faaf

@afc163
Copy link
Member

@afc163 afc163 commented on 273faaf Dec 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改漏了。。:sweat:

@Peleg
Copy link

@Peleg Peleg commented on 273faaf Dec 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benjycui do you know when this will be released on npm? tried to find mention of release cycles in readme w/out luck

@benjycui
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every weekend.

Please sign in to comment.