moment / luxon

⏱ A library for working with dates and times in JS
https://moment.github.io/luxon
MIT License
15.23k stars 730 forks source link

defaultZoneName broken? #1446

Closed gazhay closed 1 year ago

gazhay commented 1 year ago

Describe the bug I'm sure its a "me" bug, but I cannot get defaultZoneName to work at all.

To Reproduce <script src="/js/luxon.min.js" charset="utf-8"></script>

        console.log("User TZ ",luxon.DateTime.local().zoneName);
        luxon.Settings.defaultZoneName = "utc";
        console.log("Luxon now set to ",luxon.DateTime.local().zoneName );

Actual vs Expected

I expect that the "Luxon now set to" would return "UTC" or similar

Instead :

User TZ  Europe/Isle_of_Man
Luxon now set to  Europe/Isle_of_Man

Linux, Chrome Stable, Version 114.0.5735.106 (Official Build) (64-bit) Luxon [https://moment.github.io/luxon/global/luxon.min.js] TZ : Europe/Isle_of_Man

diesieben07 commented 1 year ago

defaultZoneName was removed with Luxon 2.x. Simply use defaultZone instead.

gazhay commented 1 year ago

Ok, thanks.

Probably needs a documentation update too.

[https://moment.github.io/luxon/#/zones] is where I copied and pasted the above from.

gazhay commented 1 year ago

Same result though :-

console.log("Luxon again!", luxon.DateTime.local().zoneName);
        luxon.Settings.zoneName = "utc";
        console.log("Luxon set to utc", luxon.DateTime.local().zoneName);
Luxon again! Europe/Isle_of_Man
Luxon set to utc Europe/Isle_of_Man
diesieben07 commented 1 year ago

The property is called defaultZone. You're right though, that part of the documentation is outdated, I'll make sure to update it.

gazhay commented 1 year ago

Doh! of course it is, curse my eyesight, Thanks

icambron commented 1 year ago

See #1394 for the docs fix