Skip to content
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

In Safari, .convert() generates an Invalid date in certain scenarios when converting from a string date to a Date() object. #2

Open
cssquirrel opened this issue Jul 10, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@cssquirrel
Copy link
Contributor

How to reproduce:

While using Safari, perform a conversion using:

OrcDate.convert('2012-07-24', 'YYYY-MM-DD', 'Date');

The object returned will be an "Invalid Date".

@cssquirrel cssquirrel added the bug Something isn't working label Jul 10, 2019
@cssquirrel cssquirrel self-assigned this Jul 10, 2019
@cssquirrel
Copy link
Contributor Author

The reason for this turns out to be an issue with the converter transforming the string values into numbers before plugging them into the conversion for a Date() object, in cases where the value for a month or day is less than 10.

Safari is expecting values of 'YYYY-MM-DD' with leading zeros when using new Date('2012-07-24'). Without leading zeros (e.g. new Date('2012-7-24')), a less than 10 value on month or day passes in Firefox but generates an error in Safari.

@PeteDuncanson
Copy link
Member

Can we have a test created for that to stop any regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants