Topic: Date Picker Disbale Past
*Expected Behavior:*When pastDates is set to 06/30/2024 (MM/DD/YYYY), the date picker should block selection of any date before July 1, 2024. This functionality is working as intended.
*Actual Behavior:*Although dates in June are correctly disabled, the month of June remains selectable in the date picker, which can be misleading to users.
Select a date
pastDates = new Date(new Date(2024, 6, 30).setHours(0, 0, 0, 0));
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Pro
- Premium support: Yes
- Technology: MDB Angular
- MDB Version: MDB5 8.0.0
- Device: Laptop
- Browser: Chrome
- OS: Mac - IOS
- Provided sample code: No
- Provided link: No
Arkadiusz Idzikowski staff commented 2 weeks ago
Do you use any other settings? We tested that on default component (with only
minDate
option, MDB Angular v8.0.0) and we could not reproduce such a problem.jcarvalho pro premium priority commented 2 weeks ago
No, I'm not using any other settings. I'm using the default snippet as provided in the documentation. I’ve attached the code snippet showing what I’m using. Let me know if that helps clarify the issue!
Sorry for the mix-up with the date earlier! Just to clarify, the correct date I’m using is new Date(new Date(2024, 6, 31).setHours(0, 0, 0, 0)); instead of new Date(new Date(2024, 6, 30).setHours(0, 0, 0, 0));.
Select a date
Typescript: this.pastDates = new Date(new Date(2024, 6, 31).setHours(0, 0, 0, 0));
Arkadiusz Idzikowski staff commented 2 weeks ago
I think I misunderstood which dates you want to block when I checked it the first time.
Setting
new Date(new Date(2024, 6, 31).setHours(0, 0, 0, 0));
as[minDate]
should block all the dates before July 31, 2024 (because the month is 0 indexed). In this case June should be disabled, but July will be enabled because it is still possible to select the last day of the month.I finally managed to reproduce the problem, but only after setting
[minDate]
to the first day of the month (for examplenew Date(new Date(2024, 6, 1).setHours(0, 0, 0, 0)
); . In such cases, the entire previous month should be blocked, but due to a bug, it is possible to select it in the month view.Could you please confirm whether adding a fix for this case will solve the problem you encountered?
jcarvalho pro premium priority commented 2 weeks ago
Yes, please go ahead and fix that bug. It sounds like exactly the issue I'm running into. A fix for this case should solve the problem. Thanks for looking into it!