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

fromISO does not handle timezone when parsing ISO 8601 ordinal dates format #892

Closed
jolly-yang opened this issue Mar 8, 2021 · 3 comments · Fixed by #966
Closed

fromISO does not handle timezone when parsing ISO 8601 ordinal dates format #892

jolly-yang opened this issue Mar 8, 2021 · 3 comments · Fixed by #966

Comments

@jolly-yang
Copy link

Describe the bug
When parsing the ISO 8601 ordinal date format, the time zone seems to be omitted.

Actual vs Expected behavior

const { DateTime } = require('luxon');

// It expected to print 8, but got 9.
console.log(DateTime.fromISO('2013-039T09:30:26.123+09:00').setZone('Etc/GMT-8').hour);

// It expected to print 9, but got 7.
console.log(DateTime.fromISO('2013-039T07:00:00.00+0600').setZone('Etc/GMT-8').hour);

Desktop (please complete the following information):

  • OS: OSX 10.15.4
  • luxon: 1.26.0 and 1.25.0
  • node: v14.15.4
  • npm: 6.14.10
@wcauchois
Copy link

Hi, is there any update on this issue? I just ran into it and found it to be very unintuitive behavior.

The docs for DateTime.fromISO state:

opts.zone use this zone if no offset is specified in the input string itself. Will also convert the time to this zone

which definitely makes it seem like this is a bug and not intentional behavior.

@icambron
Copy link
Member

icambron commented Jul 2, 2021

Looks like fromISO might not be respecting the offset when the string specifies an ordinal. FIx looks pretty easy, I'll get it into the next version

@wcauchois
Copy link

You rule @icambron!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants