-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(module:datepicker): support [nzDisabledDate] property in month mode #451
feat(module:datepicker): support [nzDisabledDate] property in month mode #451
Conversation
@@ -334,7 +339,8 @@ export class NzCalendarComponent implements OnInit { | |||
index : i, | |||
name : this._listOfMonthName[ i ], | |||
isCurrentMonth : moment(new Date()).month() === i && date.isSame(new Date(), 'year'), | |||
isSelectedMonth: this._showMonth === i | |||
isSelectedMonth: this._showMonth === i, | |||
disabled : this.nzDisabledDate && this.nzDisabledDate(date.month(i).toDate(), 'month') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why need to add param 'month' here?
should nzDisabledDate function work same for both day and month mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because can judgment in day mode. the month picker only needs to be accurate to month.
like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hsuanxyz but the function works for day mode also works for month mode, is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just think this design is somewhat redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in the date range demo, if the end of the date part is greater than the start. will be wrongly disabled.
eg: 2017-10-20 20:00
- 2017-11-20 10:00
The end date of October will be disabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is better?
- disabled : this.nzDisabledDate && this.nzDisabledDate(date.month(i).toDate(), 'month')
+ disabled : this.nzDisabledDate && this.nzDisabledDate(date.month(i).day(0).toDate())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should not disable the month when the disable function across the month range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, thank for you suggestion.
9a58653
to
4169d1b
Compare
@vthinkxie updated, new behavior: |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #442
What is the new behavior?
Does this PR introduce a breaking change?
Other information