How to clear the timezone associated with a moment-timezone objectHow to convert windows timezone to moment js timezonemoment timezone adjust timestamp to a timezone and return valueTo use timezones with moment do you replace all moment references with moment-timezone instead?timezone and utc using Moment Timezone jsCreate moment.js date from milliseconds in local timezoneGetting a time difference across timezones with moment-timezoneConfiguring WebPack with Moment TimeZone CDNConvert time from other timezone to local timezone using moment/moment-timezoneGet Las Vegas time using moment timezone js
Heyawake - why is this wrong solution
Using processing toolbox conditionally in QGIS?
Why is a pressure canner needed when canning?
Why doesn't Raiden release channel capacity immediately when routing fails?
Is using different public keys for different peers safer than reusing the public key, beyond forward secrecy - x25519
How can I determine which permissions needs to be assigned to the newly created login?
How can I describe hit point damage without talking about wounds?
'This one' as a pronoun
In-universe, why does Doc Brown program the time machine to go to 1955?
Tiny image scraper for xkcd.com
Where on Earth is it easiest to survive in the wilderness?
First Number to Contain Each Letter
What would a biological creature need in order to see into the future?
Was "The Hobbit" ever abridged?
Left my gmail logged in when I was fired
A magician's sleight of hand
What quests do you need to stop at before you make an enemy of a faction for each faction?
Is there any difference between these two sentences? (Adverbs)
Is mathematics truth?
Shoes for commuting
Would you recommend a keyboard for beginners with or without lights in keys for learning?
Has Rey's new lightsaber been seen before in canon or legends?
Who are these people in this satirical cartoon of the Congress of Verona?
Does blackhole merging breaks their event horizon seggregation?
How to clear the timezone associated with a moment-timezone object
How to convert windows timezone to moment js timezonemoment timezone adjust timestamp to a timezone and return valueTo use timezones with moment do you replace all moment references with moment-timezone instead?timezone and utc using Moment Timezone jsCreate moment.js date from milliseconds in local timezoneGetting a time difference across timezones with moment-timezoneConfiguring WebPack with Moment TimeZone CDNConvert time from other timezone to local timezone using moment/moment-timezoneGet Las Vegas time using moment timezone js
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Using moment-timezone, if you have a moment object set with a timezone e.g. moment.tz('America/New_York'), how can you clear the timezone and change the moment to "local" time?
Notably, moment.local() does not work (a subsequent call to moment.tz() still equals America/New_York). I can confirm that my local time is not America/New_York.
The only solution I have found is to set an invalid timezone, e.g. moment.tz('local'). This logs a warning to the console that you have attempted to set an invalid timezone (annoying), but it does clear the timezone associated with the moment object, returning it to a local moment object. The warning that moment-timezone spits out emphasizes that this solution may break in the future though, and it's obviously a hack.
What's the proper way to accomplish this?
moment-timezone
add a comment |
Using moment-timezone, if you have a moment object set with a timezone e.g. moment.tz('America/New_York'), how can you clear the timezone and change the moment to "local" time?
Notably, moment.local() does not work (a subsequent call to moment.tz() still equals America/New_York). I can confirm that my local time is not America/New_York.
The only solution I have found is to set an invalid timezone, e.g. moment.tz('local'). This logs a warning to the console that you have attempted to set an invalid timezone (annoying), but it does clear the timezone associated with the moment object, returning it to a local moment object. The warning that moment-timezone spits out emphasizes that this solution may break in the future though, and it's obviously a hack.
What's the proper way to accomplish this?
moment-timezone
add a comment |
Using moment-timezone, if you have a moment object set with a timezone e.g. moment.tz('America/New_York'), how can you clear the timezone and change the moment to "local" time?
Notably, moment.local() does not work (a subsequent call to moment.tz() still equals America/New_York). I can confirm that my local time is not America/New_York.
The only solution I have found is to set an invalid timezone, e.g. moment.tz('local'). This logs a warning to the console that you have attempted to set an invalid timezone (annoying), but it does clear the timezone associated with the moment object, returning it to a local moment object. The warning that moment-timezone spits out emphasizes that this solution may break in the future though, and it's obviously a hack.
What's the proper way to accomplish this?
moment-timezone
Using moment-timezone, if you have a moment object set with a timezone e.g. moment.tz('America/New_York'), how can you clear the timezone and change the moment to "local" time?
Notably, moment.local() does not work (a subsequent call to moment.tz() still equals America/New_York). I can confirm that my local time is not America/New_York.
The only solution I have found is to set an invalid timezone, e.g. moment.tz('local'). This logs a warning to the console that you have attempted to set an invalid timezone (annoying), but it does clear the timezone associated with the moment object, returning it to a local moment object. The warning that moment-timezone spits out emphasizes that this solution may break in the future though, and it's obviously a hack.
What's the proper way to accomplish this?
moment-timezone
moment-timezone
asked Mar 28 at 3:51
JohnJohn
3,6851 gold badge16 silver badges39 bronze badges
3,6851 gold badge16 silver badges39 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Update
This issue was caused by a bug in moment-timezone. As of version, 0.5.24, moment.local() should correctly clear the time zone associated with a moment-timezone object.
Original
At the...moment! This appears to be a bug in moment-timezone (see #738, #258). The current work-around I've found is to first use moment.utc() (which clears the timezone and also sets the moment in "utc" mode) and then moment.local(). I.e. moment.utc().local().
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389895%2fhow-to-clear-the-timezone-associated-with-a-moment-timezone-object%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Update
This issue was caused by a bug in moment-timezone. As of version, 0.5.24, moment.local() should correctly clear the time zone associated with a moment-timezone object.
Original
At the...moment! This appears to be a bug in moment-timezone (see #738, #258). The current work-around I've found is to first use moment.utc() (which clears the timezone and also sets the moment in "utc" mode) and then moment.local(). I.e. moment.utc().local().
add a comment |
Update
This issue was caused by a bug in moment-timezone. As of version, 0.5.24, moment.local() should correctly clear the time zone associated with a moment-timezone object.
Original
At the...moment! This appears to be a bug in moment-timezone (see #738, #258). The current work-around I've found is to first use moment.utc() (which clears the timezone and also sets the moment in "utc" mode) and then moment.local(). I.e. moment.utc().local().
add a comment |
Update
This issue was caused by a bug in moment-timezone. As of version, 0.5.24, moment.local() should correctly clear the time zone associated with a moment-timezone object.
Original
At the...moment! This appears to be a bug in moment-timezone (see #738, #258). The current work-around I've found is to first use moment.utc() (which clears the timezone and also sets the moment in "utc" mode) and then moment.local(). I.e. moment.utc().local().
Update
This issue was caused by a bug in moment-timezone. As of version, 0.5.24, moment.local() should correctly clear the time zone associated with a moment-timezone object.
Original
At the...moment! This appears to be a bug in moment-timezone (see #738, #258). The current work-around I've found is to first use moment.utc() (which clears the timezone and also sets the moment in "utc" mode) and then moment.local(). I.e. moment.utc().local().
edited Apr 30 at 15:01
answered Mar 29 at 7:00
JohnJohn
3,6851 gold badge16 silver badges39 bronze badges
3,6851 gold badge16 silver badges39 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389895%2fhow-to-clear-the-timezone-associated-with-a-moment-timezone-object%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown