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
2
votes
0 answers

React countdown timer to run only on EST

I am using react-countdown-timer to display a counter in my React app. I want the timer to always use EST to compare as current time even if the page is loaded in any other time-zone. In the documentation, I do see that it accepts a custom now()…
Arihant
  • 3,847
  • 16
  • 55
  • 86
2
votes
1 answer

Check if date has already been parsed with moment

I am passing down a date string which needs to be parsed appropriately with moment. The problem is in some circumstances it is getting parsed twice, which causes it to become undefined. this is what the code currently looks like: moment.tz(dt, 'MMMM…
theJuls
  • 6,788
  • 14
  • 73
  • 160
2
votes
3 answers

Node JS Error: Moment Timezone has no data for 2018-08-08T10:00:00

I am trying to initialize time of los_angles time zone in moment. But it is throwing the following error: Moment Timezone has no data for 2018-08-08T10:00:00 Following is my…
MGupta
  • 75
  • 2
  • 9
2
votes
1 answer

Display time with different timezone giving wrong value using moment

I want to display time with 3 different time zone. eg. Considering "America/Mexico_City" as standard. 1. "America/New_York" is 1 hr ahead of Mexico_City 2. "America/Los_Angeles" is 2 hrs behind of Mexico_City But I am getting exactly opposite o/p…
pankaj
  • 159
  • 10
2
votes
1 answer

How to convert windows timezone to moment js timezone

i have a dropdown to select timezone in UI. that dropdown data taken from windows timezone settings dropdown list If logged user in selected some timezone, i have to display all datetime fields according to selected timezone format with DST. My…
gowtham ks
  • 427
  • 5
  • 6
1
vote
1 answer

Does Moment Timezone automatically adjust the time based on DST when formatting a time string?

I want to convert the UTC ISO 8601 date string into the user's local date time based on the user's Time Zone. I'm using moment-timezone to accomplish this task, and here is the code snippet: const userTimezone = moment.tz.guess(); const time =…
1
vote
3 answers

change time base on timezone momen-timezone

i want to convert selected time into timezone saved in user profile using moment-timezone library my local system timezone is PKT(pakistan) and user has saved timezone in his Profile is AEST(australian/sydney). so when user select time i just want…
Bilal Butt
  • 1,202
  • 3
  • 12
  • 15
1
vote
1 answer

EDT timezone works but same does not work for IST in Moment

I am able to convert below object to moment var dateStr = "Tue Dec 06 00:00:00 EDT 2022"; var momentDateFormatted = moment(dateStr).format("MM-DD-YYYY"); alert(momentDateFormatted); //07-14-2014 But this doesnt work for below code var dateStr1 =…
Keshav
  • 1,123
  • 1
  • 18
  • 36
1
vote
3 answers

(moment-timezone). convert time from one timezone to another timezone

I am in India, and selecting time 9:00 AM, and timezone eg. 'America/Dawson' and I want to convert time according to selected timezone to 'America/New_York' timezone.But Not getting result var currentDate = new Date() currentDate.setHours(9,…
1
vote
1 answer

moment().tz() is not giving same .isDST() value as moment.tz()

I am facing an issue related to DaylightSaving where time in America/Los_Angeles timezone is not adjusting to the Daylight savings when I use moment().tz(America/Los_Angeles). >> let c = moment('2023-03-12 9:15 AM', 'YYYY-MM-DD HH:mm…
GauthamGAjith
  • 367
  • 1
  • 4
  • 19
1
vote
1 answer

Using moment.js Timezone to set starting timezone and converting to other timezones

I'm following an example from https://www.alex-arriaga.com/how-to-set-moment-js-timezone-when-creating-a-date/ but not getting the results I'm expecting. My startDateAndTimeString has the time set to 08:00 and I set the timezone to Mexico_City which…
Rich
  • 6,470
  • 15
  • 32
  • 53
1
vote
1 answer

How to fix error TS2339: Property 'tz' does not exist on type 'Moment'?

In rails app, I created frontend app which uses angular. Here I am using moment and moment-timezone like "moment": "^2.22.2", "moment-timezone": "^0.5.23", In timezone.service.ts importing and using like import * as moment from…
Shruthi R
  • 1,863
  • 4
  • 39
  • 77
1
vote
0 answers

Type 'string' has no properties in common with type 'LocaleOptions'

Hello I am trying make this sample code which is in from moment into luxon that is given below, const date8 = ''; console.log(`This moment date Method 8 : `, moment(date8[0]).startOf('hour')); Received Output: This moment date Method 8 :…
GCT
  • 43
  • 7
1
vote
1 answer

Moment TimeZone returns incorrect UTC Offset in minutes

I need to calculate the Offset in Minutes from UTC for a future appointment. The date and time of the appointment is entered by a user in their Local date and time. I need the Offset from UTC so my server can email a remainder an hour before the…
Zak
  • 15
  • 1
  • 7
1
vote
1 answer

Moment TZ - Convert date into another timezone ISO string

I'm trying to convert a date in GMT to PST. The GMT date is 2022-11-16T00:00:00, therefore the PST date should be 2022-11-15T16:00:00. My code is as follows: const startDateGMT = moment(startTime).tz(myTimezone, true); console.log('START DATE GMT…
Alk
  • 5,215
  • 8
  • 47
  • 116