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.

1.11.4 fix which returns default timezone if set for the alias 'local' breaks everything

See original GitHub issue

Hello.

Until the recent update to 1.11.4 using local time zone as a string explicitly set the zone to the browser default. While this was unexpected initially, we worked around it as follows:

// Set default time zone for project:
Settings.defaultZoneName = timezone || 'local';

// To interpret server side dates given in ISO:
const zonedDate = DateTime.fromISO(date); // Interprets it as the project timezone

// Show on the UI: Must be scoped to browser timezone so as to show it in terms of the local time
// which may be different from the project timezone (Ex: A user in Japan selecting shift timings in a 
// date input for a project in India - The user in Japan must be able to select times (say 8am to 3pm) 
// in his/her worldview without having to do conversions
const displayDate = zoneDate.setZone('local', {keepLocalTime: true});

// Parse input from the date-picker in browser zone, convert to project timezone, convert to ISO for server
const utc = DateTime
                                .fromJSDate(date, {zone: 'local'})
                                 // Get project time zone by checking the zone of .a new DateTime object
                                .setZone(DateTime.local().zoneName, {keepLocalTime: true})
                                .setZone('utc')
                                .toMillis()

Now obviously this has stopped working. I have to admit that the new behaviour should be the expected behaviour. I was initially surprised by the older behaviour and had to code around it. Now this fix is breaking all our code 😆 . While this is something which can be fixed on our end, I feel there is a legitimate need to be able to quick access the browser default.

Perhaps we can introduce a new alias like local such as system? Or is there a better solution I’m not seeing? (I’d like to avoid the use of the timeZoneOffset from the native date object although that is one feasible solution)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
GillesDebunnecommented, Mar 25, 2019

Upon reflection, I agree with this proposal and I’d be happy to contribute to the PR.

0reactions
icambroncommented, Jul 11, 2019

Fixed in 2.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change: the logging - Nginx.org
*) Workaround: when a hostname used in the "listen" directive resolves to multiple addresses, nginx now ignores duplicates within these addresses. *) Bugfix: ......
Read more >
Changelog • data.table - GitLab
table with one row that describes each element of the measure.vars vector(s). These data/columns are copied to the output instead of the usual...
Read more >
Kernel — Elixir v1.13.4 - HexDocs
Kernel is Elixir's default environment. It mainly consists of: ... Returns an atom representing the name of the local node. ... defmodule(alias, do_block)....
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
... Bug:80815 - "app-text/tmview-1.03 - a set of DVI viewers - dvisvga, ... not find correct autoexec.cfg, runs default quake3, curl error" status:RESOLVED ......
Read more >
ara Documentation - Read the Docs
1.13.5 Can I set up the different components of ARA on different servers ? ... With defaults and using a local sqlite database:....
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