luxon: DateTime.toFormat('ZZZZ') not showing expected output

According to the docs, when the ‘ZZZZ’ token is passed in the format string, the abbreviated named offset string should be displayed in the output string. However, the timezone offset from GMT is being displayed instead.

Code snippet to test the issue:

DateTime.fromISO("2019-05-03T10:59:22Z")
.setZone("America/Los_Angeles")
.toFormat('dd-MMM-yy hh:mm:ss ZZZZ');

Expected Output:

03-May-19 03:59:22 PDT

Actual Output:

03-May-19 03:59:22 GMT-7

Package Version: ^1.13.0

Environments: node@12.1.0, Chrome

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

I’m getting the same issue on MacOS Big Sur while running tests in Jest on Node 16.3.

ZZZZ returns GMT+2 (expected CEST) ZZZZZ returns Central European Summer Time

I have the same results using Firefox 81.0 on the same OS. For a non-DST date (i.e. in the winter), it returns GMT+1 or CET respectively.