Questions tagged [moment-timezone]

Moment-timezone is an add-on for Moment.js that provides IANA time zone support. Use this tag for issues with moment-timezone, but also tag it with [moment]. NOTE: As of September 2020, the Moment team recommends you chose a different library for new projects. See the Project Status section of the Moment docs. On StackOverflow, please refrain from recommending Moment as a solution unless Moment is specifically asked for in the question.

Moment-timezone is an add-on for Moment.js that provides IANA time zone support.


Important:

As of September 2020, the Moment team recommends you choose a different library than Moment for new projects. Please read https://momentjs.com/docs/#/-project-status/

On StackOverflow, please refrain from recommending Moment as a solution unless Moment is specifically asked for in the question.

401 questions
0
votes
2 answers

Array with number of days using moment

I am trying to create an array with number of days between two dates. The dates can be anything but i am using the following for this example. Start : 11/30/2018, End: 09/30/2019 Array= [30,31,29,30....31] What i am trying to do: Here date ranges…
ace23
  • 142
  • 1
  • 16
0
votes
1 answer

Moment misunderstanding utcOffset

I'm working with moment and moment-timezone and I don't get it. Can anyone explain me why this happens? THIS (which is what I want): moment('2018-11-28T00:00:00.000-02:00').toISOString() Prints…
ismaestro
  • 7,561
  • 8
  • 37
  • 50
0
votes
1 answer

Getting a time difference across timezones with moment-timezone

I am given a string representing a time, and a timezone ID. I need to determine whether the time in question occurs within the next half hour, but the computer I'm running on is in a different timezone than the one where the string was captured. …
Carl Manaster
  • 39,912
  • 17
  • 102
  • 155
0
votes
1 answer

moment tz convert string

This should be simple, but I spent hours going over documentation and still got nothing. I have this string: var time = "2018-09-29 23:50:21" This time is in UTC, even though it does not say so, I know it is. I want to convert it to PST…
Ben
  • 2,957
  • 2
  • 27
  • 55
0
votes
1 answer

Create moment.js date from milliseconds in local timezone

A response I'm getting from the server is a 'local' timestamp. Which would mean my local time expressed as UTC milliseconds, but without the UTC offset. For example: 1537747200000 is Mon Sep 24 2018 00:00:00 UTC Mon Sep 24 2018 03:00:00 EEST (my…
knee pain
  • 600
  • 3
  • 19
0
votes
1 answer

Querying by timezone vs location

Moment-timezone time has method momnet.tz that takes two params: particular datetime timezone name It returns time shift (to UTC) that was at given timezone in given datetime. Ok. The question that bothers me: do all the locations that currently…
WHITECOLOR
  • 24,996
  • 37
  • 121
  • 181
0
votes
1 answer

How to get timestamp for converted i18n date using momentjs

I'm using momentjs with timezone. I've converted date to i18n using moment.locale('pt'); Now I want to get timestamp of the date. I get date value as converted i18n date, i.e. Ago 14 2018 22:00 I tried with moment("Ago 14 2018…
Noopur Dabhi
  • 1,867
  • 25
  • 38
0
votes
1 answer

what is the possible reason behind getting negative UTC time?

m_date - (moment.tz.zone('America/New_York').offset(m_date) * 60000); This is the code that I am using, I am actually passing a date and returning the above value. Library used is : moment-timezone
user9586039
0
votes
0 answers

momentjs - Parse text in a particular timezone if format is given

I have a scenario where I have the format, timezone, and the date text and I want to return a moment object such that the date is formed in that timezone: import moment from 'moment'; import 'moment-timezone'; const timezone =…
Neha M
  • 443
  • 1
  • 4
  • 13
0
votes
0 answers

Timezone mapping based SQL Server time zone info

I have following timezone list, which is a drop down in my application, I am facing now issue of daylight saving, I need to attached addition column in my table from sys.time_zone_info so can use AT TIME ZONE function: -12:00 (UTC-12:00)…
Furqan Misarwala
  • 1,743
  • 6
  • 26
  • 53
0
votes
0 answers

To use timezones with moment do you replace all moment references with moment-timezone instead?

I'm trying to understand when moving from using moment to using moment-timezone, do I need to replace references to the imported moment with references to moment-timezone instead? Does one replace the other (if I want to use moment-timezone…
Kevin Hooke
  • 2,583
  • 2
  • 19
  • 33
0
votes
1 answer

moment invalid date - string to moment - hh:mm:ss zzz mm/dd/yyyy (02:10:02 SGT 06/07/2018)

I am using moment-timezone I have datetime with timezone string like below, 02:10:02 EST 07/06/2018 (America/New_York) 02:10:02 MST 07/06/2018 (America/Denver) 02:10:02 CST 07/06/2018 (America/Chicago) 02:10:02 PST 07/06/2018…
Satyam Koyani
  • 4,236
  • 2
  • 22
  • 48
0
votes
0 answers

Set timezone/offset without changing actual time in moment.js

I am trying to convert from CST(-06:00) to IST(+05:30) using moment.js. The problem is initially I am having only date and time. So when I am setting manually using utcOffset(-360) in moment, it actually changes the actual time. How can I set…
Abraham Gnanasingh
  • 837
  • 2
  • 10
  • 31
0
votes
1 answer

moment timezone adjust timestamp to a timezone and return value

I try to modify timestamps timezone with moment-timezone and I want to get the modified value with the applied offset var newTimestamp = momentTz.tz(timestamp, 'Europe/Berlin') so here is what I try var results = {}; for (var timestamp in…
fefe
  • 8,755
  • 27
  • 104
  • 180
-1
votes
1 answer

Converting moment into luxon times and hours

How can i migrate this line into luxon from moment, the code sample is given below, This code sample is in moment, and i want to do it in luxon. timezone: null, getIn: moment().hour(14).minute(0) .second(0) .millisecond(0), …
GCT
  • 43
  • 7