question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Adamfskcommented, Jun 21, 2021

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

1reaction
gdebunnecommented, Sep 29, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DateTime.toFormat('ZZZZ') not showing expected output (Again)
Previously an issue #499 has raised itself again. To recap: According to the docs, when the ZZZZ token is passed in the format...
Read more >
Where's the DateTime 'Z' format specifier? - Stack Overflow
I'm confused because I know 'Z' isn't supported according to MSDN, but the exception asks me to use it. And I what I...
Read more >
Timestamps, Time Zones, Time Ranges, and Date Formats
Learn how Sumo Logic manages timestamps, time zones, time ranges, and dates, and the configuration options that are available.
Read more >
Convert a Field to a Date Field - Tableau Help
Create a calculation using the DATE function. If the DATEPARSE function is not available for the data that you're working with, or the...
Read more >
Cannot format ISO datetime string in TRIRIGA Platform 3.5.2.3
Unable to format ISO datetime string in IBM TRIRIGA Platform 3.5.2.3 to provide a ... 6) As you can see below, it's not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found