Hello Daniel,
Different browsers have different mechanics for parsing dates, and based on the provided information, this seems to be causing the described behavior:
https://stackoverflow.com/questions/3085937/safari-js-cannot-parse-yyyy-mm-dd-date-format
As TypeScript allows formatted date string representations as their Date type too (but these strings are not actual JavaScript dates), it is possible that an actual valid JavaScript Date object is not created in the formattedDate.map(...) callback.
As assigning an array of disabled dates that are valid JavaScript Date objects, I can suggest providing some custom logic which ensures that the formattedDates array is mapped correctly to the desired Date objects array - for example log the return value, to check what it actually is before returning it:
console.log(new Date(date.getFullYear(), date.getMonth(), date.getDate()));
You can also check what calling each of the
getFullYear,
getMonth and
getDate methods return.
If the issue persists, please send us an isolated runnable project or a StackBlitz demo (just the Calendar component, and the initial formattedDate array should be enough) where the problem can be observed, so we can investigate it further, and try to provide a solution that is best suitable to the specific use case. You can use the following online demo as a base:
https://www.telerik.com/kendo-angular-ui/components/dateinputs/calendar/disabled-dates/#toc-using-a-date-array
https://stackblitz.com/edit/angular-dmsfx8?file=app/app.component.ts
Thank you in advance.
Regards,
Dimiter Topalov
Progress Telerik
Progress is here for your business, like always.
Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.