Hi Alexandre,
Thank you for reaching out to us!
When you set the value using moment(viagem.dataInicial).toDate(), it can return a date in UTC format, such as 2024-11-04T18:30:00.000Z. This may cause the error class to be added if it falls outside the defined limits for the DatePicker.
To bind the current date properly, it’s recommended to use new Date(). Here’s a code snippet demonstrating this:
datepicker.value = new Date();
|
Sample: Ckquiy (forked) - StackBlitz
This approach ensures that the date is properly recognized within the expected range of the DatePicker, preventing any error classes from being applied.
If you have any further questions or need additional assistance, feel free to ask!
Regards,
Priyanka K