-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(datepicker): min & max dates + dateFilter #3556
Conversation
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.
Nits, apply merge label when ready
src/lib/core/datetime/simple-date.ts
Outdated
* @param max The maximum date | ||
* @returns A new SimpleDate equal to this one clamped between the given min and max dates. | ||
*/ | ||
clamp(min: SimpleDate, max: SimpleDate) { |
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.
Return type?
src/lib/datepicker/calendar.ts
Outdated
/** | ||
* A date representing the current period shown in the calendar. The current period is always | ||
* normalized to the 1st of a month, this prevents date overflow issues (e.g. adding a month to | ||
* January 31st and overflowing into March). | ||
*/ | ||
get _currentPeriod() { return this._normalizedCurrentPeriod; } | ||
set _currentPeriod(value: SimpleDate) { | ||
this._normalizedCurrentPeriod = new SimpleDate(value.year, value.month, 1); | ||
let clampedValue = value.clamp(this.minDate, this.maxDate); |
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.
Nit: const? :D
src/lib/datepicker/year-view.ts
Outdated
let enabled = false; | ||
for (let date = new SimpleDate(this.date.year, month, 1); date.month === month; | ||
date = date.add({days: 1})) { | ||
enabled = enabled || this.dateFilter(date); |
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.
Do you need the enabled ||
check? Looks like if it's enabled, it will break the loop anyway.
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.
derp ><
* don't allow going past min/max date * add back missing mdSuffix * added date filtering logic * added working date filter * disabled style for prev/next buttons * add unit tests * fix lint * address comments
* don't allow going past min/max date * add back missing mdSuffix * added date filtering logic * added working date filter * disabled style for prev/next buttons * add unit tests * fix lint * address comments
* don't allow going past min/max date * add back missing mdSuffix * added date filtering logic * added working date filter * disabled style for prev/next buttons * add unit tests * fix lint * address comments
* don't allow going past min/max date * add back missing mdSuffix * added date filtering logic * added working date filter * disabled style for prev/next buttons * add unit tests * fix lint * address comments
* don't allow going past min/max date * add back missing mdSuffix * added date filtering logic * added working date filter * disabled style for prev/next buttons * add unit tests * fix lint * address comments
* don't allow going past min/max date * add back missing mdSuffix * added date filtering logic * added working date filter * disabled style for prev/next buttons * add unit tests * fix lint * address comments
* don't allow going past min/max date * add back missing mdSuffix * added date filtering logic * added working date filter * disabled style for prev/next buttons * add unit tests * fix lint * address comments
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.