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.

Side-effects of settings defaultZoneName

See original GitHub issue

I came across this whilst trying to mock dates within tests, and found it rather un-intuitive, so thought I’d raise after having a quick check for any mentions previous.

As part of my tests, I wanted to change the timezone, so I changed the value of Settings.defaultZoneName in order to accomplish this. To unpatch the setting, I captured its previous value and re-instated, e.g.:

someTestCase(() => {
  let original;

  beforeEach(() => {
    Settings.defaultZoneName = 'Asia/Singapore';
  });

  afterEach(() => {
    Settings.defaultZoneName = original;
  });
}

However, after debugging and issue I found that this is not in fact restoring the original state:

The end result is that you end up with this, slightly confusing (at least in my mind) behaviour:

luxon.Settings.defaultZone
// OUT: LocalZone {}

// Set the defaultZoneName to equal its current value
luxon.Settings.defaultZoneName = luxon.Settings.defaultZoneName

luxon.Settings.defaultZone
// OUT: IANAZone {zoneName: "Asia/Singapore", valid: true}

My initial thought would be to have the defaultZoneName return null when the defaultZone is a LocalZone instance, but I’m not well enough versed in the Luxon codebase to understand the ramifications of that change.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
icambroncommented, Feb 18, 2019

I think I will make the breaking change you suggest, which is to make defaultZoneName return null by default. I think that should work fine for most cases, because internally Luxon is always looking for defaultZone itself, never the name.

0reactions
icambroncommented, Jul 11, 2019

Fixed in 2.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

1. Service Discovery: Eureka Clients - Spring Cloud
Setting the value in bootstrap.yml causes undesirable side effects, such as registering in Eureka with an UNKNOWN status. If you require more control...
Read more >
How to use the luxon.Settings.defaultZoneName function in ...
To help you get started, we've selected a few luxon.Settings.defaultZoneName examples, based on popular ways it is used in public projects.
Read more >
Cisco MDS 9000 Family NX-OS Fabric Configuration Guide
Denies (default) traffic flow to default zone members. About FC Alias Creation. You can assign an alias name and configure an alias member...
Read more >
luxon 3.1.1 | Documentation
Configuration properties that effect how output strings are formatted, ... Configuration See the DateTime#locale and DateTime#numberingSystem accessors.
Read more >
Quickstart: Set up DNS records for a domain name with Cloud ...
Create a CNAME record for the www subdomain · In the Google Cloud console, go to the Cloud DNS page. · Click the...
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