-
Notifications
You must be signed in to change notification settings - Fork 156
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
Safari/Webkit: Invalid Date for input date format YYYY-MM-DD h:i:s #73
Comments
Same here, this error is thrown only on Internet Explorer (11.1) :
and then IE can't even interpret it and throws this error in my console :
|
Don't know if that can fix your problem, but I fixed mine using the Date.parse() method in javascript :
|
In Safari/Webkit you can try YYYY/MM/DD instead YYYY-MM-DD |
another solution i found on stackoverflow was using moment
|
Try this: |
|
Try this : |
Highly overloaded library. Works but I do not recommend to use moment when you want a light app. |
Someone is looking to this one? |
and fixed by @alextouzel solution
|
Using Date constructor on a string date with format YYYY-MM-DD h:i:s, I got similar error with safari while the same code was working well with chrome. The solution for me was to transform a format like this YYYY-MM-DD h:i:s to a format like this YYYY-MM-DDTh:i:s (notice the capital T between the date part and the time part). I dit the transformation with a code like this: let d = '2021-09-12 00:00:00'; d = d.replace(' ', 'T') and now when I do : new Date(d) everything works well. |
I receive an Invalid date error for a properly valid date param mentioned in title. It's not UTC but it's a valid date on Safari Webkit.
Works fine on chrome and firefox.
Doesn't work on Chrome, Safari - iOS, Safari - MacOS
The text was updated successfully, but these errors were encountered: