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.

Question about parsing in other timezones

See original GitHub issue

First of all, thanks for the great library!

I had a question about timezone behavior: When chrono detects a timezone specified in the input string, that shows up under timezoneOffset in knownValues, and is accounted for when the input is parsed. When no timezone is specified, chrono parses the date in the local timezone, and no timezone offset is made.

I have a use case where I would like to parse dates in another timezone that does not match the local timezone, without being specified explicitly in the input string (it’s an application setting–the use case is viewing operational metrics in a specific timezone: many users prefer UTC than their local timezone, since it’s common across all their systems). Is it possible to have chrono assume another timezone when parsing? If not, is there a suggested workaround?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
erbridgecommented, Sep 7, 2020

@uhoh-itsmaciek The custom Refiner solution worked for me.

1reaction
wanasitcommented, May 10, 2020

I see. That would be challenging. Chrono doesn’t have the logic for looking up DST change. You probably have to check the parsed results, adjust the timezoneOffset, and check the resulted period and account for the DST manually.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parsing date with different time zones - Stack Overflow
Using the SimpleDateFormat and setting its time zone as utc via sdf.setTimeZone(TimeZone.getTimeZone("UTC")) wasn't enough. The parser still ...
Read more >
Strange UTC offset time zone parsing in Postgres
Another issue to keep in mind is that in POSIX time zone names, positive offsets are used for locations west of Greenwich.
Read more >
Problem parsing unattend answer file (Missing time zone)
I've received an error with using a custom unattend.xml file when testing a Windows 10 image. After checking the setupact file, ...
Read more >
Trouble parsing US Timezone abbreviations #445 - GitHub
I'm using moment-timezone via npm under Node.js (so I've got all the data files I think). I'm trying to parse a bunch of...
Read more >
JR63733: IDR FOR POSTGRESQL SOURCE FAILS ... - IBM
Parser error when no value given for microseconds or timezone, ... SOURCE FAILS WHEN PARSING TIMESTAMP WITH TIMEZONE COLUMN DATA WITH NO FRACTIONAL...
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