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

DateTime.fromISO does not work with lowercase 't' #1610

Open
toymachiner62 opened this issue Mar 26, 2024 · 1 comment · May be fixed by #1624
Open

DateTime.fromISO does not work with lowercase 't' #1610

toymachiner62 opened this issue Mar 26, 2024 · 1 comment · May be fixed by #1624

Comments

@toymachiner62
Copy link

Describe the bug

When a date has a lowercase 't' between the date and time instead of uppercase 'T', Luxon's DateTime.fromISO() does not parse correctly while the built in javascript Date.parse() does.

DateTime.fromISO('2020-01-01t00:00:00-0300') //  DateTime { Invalid, reason: unparsable }
DateTime.fromISO('2020-01-01T00:00:00-0300') //  DateTime { ts: 2019-12-31T21:00:00.000-06:00, zone: America/Chicago, locale: en-US }
Date.parse('2022-01-01t00:00:00.000Z') // 1640995200000
Date.parse('2022-01-01T00:00:00.000Z') // 1640995200000

Similarly to #1609, the RFC 3339 spec states:

NOTE: Per [[ABNF](https://www.rfc-editor.org/rfc/rfc3339#ref-ABNF)] and ISO8601, the "T" and "Z" characters in this
      syntax may alternatively be lower case "t" or "z" respectively.

To Reproduce
Please share a minimal code example that triggers the problem:

Actual vs Expected behavior
A lowercase 't' should be parsable.

Desktop (please complete the following information):

  • OS: Mac OS Ventura 13.6
  • Browser Chrome 123.0.6312.59
  • Luxon version 3.4.4
  • Your timezone America/Chicago

Additional context
Add any other context about the problem here.

@toymachiner62
Copy link
Author

lowercase z should also be supported

@benjamin-pike benjamin-pike linked a pull request May 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant