-
Notifications
You must be signed in to change notification settings - Fork 296
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
fix the bug that disabled date becomes central date #2361
Conversation
🦋 Changeset detectedLatest commit: 65d11f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@ryubro can you add a changeset, and fix the failing tests? |
@@ -573,7 +572,7 @@ describe('<lion-calendar>', () => { | |||
.disableDates="${/** @param {Date} d */ d => d.getDate() === 15}" | |||
></lion-calendar> | |||
`); | |||
el.focusDate(el.findNearestEnabledDate()); | |||
el.focusDate(el.findNearestEnabledDate(new 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.
Without any argument findNearestEnabledDate
uses the centralDate which is today by default, but after the PR, the initial centralDate moves to the nearest enabled date if today is disabled. Hence we're supplying explicitly today as the argument.
expect(isSameDate(el.centralDate, new Date('2019/06/03')), 'central date').to.be.true; | ||
expect(isSameDate(elSetting.centralDate, new Date('2019/07/03')), 'central date').to.be | ||
.true; | ||
expect(isSameDate(el.centralDate, new Date('2019/07/03'))).to.be.true; |
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.
After the PR, the central date would be nearest enabled date instead of today even when the date is disabled, which is the desired behavior, I believe.
What I did
this.__calculateInitialCentralDate()
andthis.__createData()
infirstUpdated
instead ofconnectedCallback
because props (likeminDate
) are not assigned yet whenconnectedCallback
is called.