-
-
Notifications
You must be signed in to change notification settings - Fork 71
add isDisabledDate #113
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
add isDisabledDate #113
Conversation
The thought was to havs But I see now that you might want to reactively update the enabled/disabled dates (right?), so then I'm not sure what API is best. I don't love the idea of having to create an array of disabled dates |
I think an isDisabledDate prop is best |
Yeah, I would want it to be reactive. I re-worked it to use a |
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.
Looks good, but it's still possible to select disabled dates by typing, using arrow keys and probably by switching the month/year
How it should probably work:
- When updating from
oldDate
tonewDate
:- If
newDate
is newer, go forward to the next enabled date - If
newDate
is older, go back to last enabled date
- If
That was an oversight on my part, I have put in a fix that should now prevent a disabled date from being selected by typing or by the arrow keys. |
I found an issue when using the DateInput. When setting the DateInput's value, it's not affected by It seems like the updated |
Oh I see now, yeah I did overlook that case. |
btw, if you feel like converting to runes syntax would fix it, I have nothing against dropping Svelte 3/4 support |
This reverts commit 8184f52.
…sabledDates' into add-enabledDates-disabledDates
After looking at it more, updating to runes wouldn't help, DatePicker is behind an if statement so it doesn't load till the date input is clicked to open it. Setting the date through the DateInput will never pass the date to the DatePicker. Also since DatePicker can be used separably, the date just needs to be check in both DateInput and DatePicker. I moved the toValidDate function to the date-utils file, then used it in both DatePicker and DateInput, it fixes the issue. If you would prefer it done a different way let me know. |
Ah makes sense, very great work! |
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.
Very great work
added the ability to enable and disable dates, using isDisabledDate function: #110
If this is not how you wanted it implemented, and would prefer a different way let me know and I can change it.