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
3
votes
1 answer

Moment.js: "TypeError: momentRange.range" when using with moment-range

I have problem using all 3 of the packages together. I define them like this: var moment = require('moment-timezone'); var momentRange = require('moment-range'); And when I want to use the moment-range functions, I'm trying to call it like…
3
votes
3 answers

Tempus Dominus Bootstrap 4 change the language/locale

In the TempusDominusBootstrap 4 options, I set the locale with (locale: moment.locale ('ru')) by first connecting the following dependencies (import * asmoment from 'moment';import 'moment / locale / en';import 'moment-timezone';) I do not get the…
2
votes
2 answers

How to get timezone offset as ±hh:mm in javascript?

I can get the Timezone offset with the following command as: new Date().getTimezoneOffset() -> -330 and using moment moment().utcOffset() as 330. However, how do I get the format as ±hh:mm?
Akash
  • 75
  • 1
  • 8
2
votes
1 answer

MomentJS UTC date is not detected as utc inside momentjs

I have a date represented as a string: const dateStr = "2022-09-29T00:00:00Z"; So this is UTC format with zero (equivalent to "2022-09-29T00:00:00+0000") When I use momentJS it is converted to my local time(and this is fine), but my local time -3…
Mykyta Halchenko
  • 720
  • 1
  • 3
  • 21
2
votes
1 answer

How to display timezone like PT, ET instead of PST, EST using moment.js

I need to use PT/ET instead of PST/EST in order to save the space in table using moment.js HTML- {{ moment.tz([2012,0],timezone).format('z')}} // It displaying EST/PST but I need only ET/PT. Note- Timezone is dynamic, So I want for any timezone it…
2
votes
1 answer

getting time zone name from offset in moment.tz

I have a api which needs to store a utc+timestamp in mongodb. I am trying to save the value in mongodb which is saving in UTC time. While retreiving i am trying to send the current time using the below code return…
Sindhu1990
  • 85
  • 6
2
votes
1 answer

JavaScript get UTC from local midnight

I have a date that comes from a Bootstrap DateTimePicker $('#datetimepicker').find("input").val() that has the format "mm/dd/yyyy".
LAffair
  • 1,968
  • 5
  • 31
  • 60
2
votes
1 answer

Datetime timezone conversion issue in Typescript

I have picked a date from matDatePIcker in angular and passed that to the cloud application. But the DateTime is then converted based on the timezone before it passes to the API. This leads to creating date mismatches when the cloud function does…
Athulya Ratheesh
  • 291
  • 4
  • 22
2
votes
1 answer

Replace a few seconds ago with just now in moment.js

How to remove few seconds ago and show just now in moment.js .The moment.js shows a few seconds ago ,I want to do some customization ,to show only just now upto 1 minute.But in other cases like two minutes ago I want to show 2 minutes ago. Example…
Khan Naxim
  • 31
  • 3
2
votes
1 answer

Node.js moment timezone conversion not working as expected

So this is what the below code should do. I am essentially making objects that expire at the midnight mark of the different timezones. The way I think I should do this is to first take user location and find the corresponding timezone. From there,…
nickcoding2
  • 142
  • 1
  • 8
  • 34
2
votes
1 answer

How does momentjs keep timezone data up to date

As timezone data can change, especially daylight saving time rules, how does momentjs keep up to date with this information? If I'm using momentjs-timezone for a scheduling system that is timezone dependent, do I need to do any maintenance to keep…
Caesar
  • 9,483
  • 8
  • 40
  • 66
2
votes
1 answer

Execute a function every midnight in a timezone (CST) different than server timezone (UTC)

I have a time zone (timerTimeZone): For e.g. "America/Chicago". let timerTimeZone = "America/Chicago" Our server local time is in UTC. I want to execute a function every night at 12.00 AM in the time zone which is stored in the timerTimeZone…
user1663715
  • 396
  • 1
  • 4
  • 19
2
votes
2 answers

Moment localization not considering time while formating date?

function formatedDate (localid, inputdate) { var locale = 'es_MX'; console.log(locale, inputdate) // Set locale to moment moment.locale(locale); // Get locale data const localeData = moment.localeData(locale); const…
Soumya Gangamwar
  • 954
  • 4
  • 16
  • 44
2
votes
1 answer

moment-timezone : Not getting desired time while converting from one timezone to other

I would like to convert "2020-09-07T00:52:26.000Z" to 07-09-2020 14:22:26, but I was not getting the desired time while conversion. Conversion needed: Asia/Kolkata to Asia/Hong_Kong I tried: const moment = require('moment-timezone'); var momentmm =…
Aldo
  • 158
  • 1
  • 10
2
votes
1 answer

Get long offset name for a timezone using moment-timezone

The luxon library adds this feature to get the offsetNameLong acc. to timezone ianaName which provides a locale specific translated zone name. For instance DateTime.local().setLocale("en-US").setZone("America/Los_Angeles").offsetNameLong // prints…
brijesh-pant
  • 967
  • 1
  • 8
  • 16
1 2
3
26 27