You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I pretty much lifted the code from the working-with-dates#example and discovered the parseDate doesn't work or is deprecated. Then I realised the functional example referenced in the migration guide did it differently and more coherently.
Just calling this out as I wasted a fair bit of time on this.
Is something wrong/not working with example itself? Works for me 🤔
This doesn't work ====>
That's because you are parsing date in date-only format, but you are providing date AND time part. yyyy/mm/dd is NOT the same as yyyy/mm/dd hh:ii. Also I noticed, you are specifying mode as date, but providing datetime format. It is not compatible, and if date fails to parse/format, it returns "now" date as fallback value. Which is your case.
For you to simplify things, remove mode property. It's resolved automatically based on specified format.
To summarize this, parseDate and formatDate works as intended, they are used in library itself. But you need to stick to exactly the same format value when parsing/formatting date, otherwise can get invalid date.
I pretty much lifted the code from the working-with-dates#example and discovered the
parseDate
doesn't work or is deprecated. Then I realised the functional example referenced in the migration guide did it differently and more coherently.Just calling this out as I wasted a fair bit of time on this.
This doesn't work ====>
Produces:
But this does ====>
The text was updated successfully, but these errors were encountered: