In 12 hours format,i have to create a interval of 15 minutes in moment which is working fine with 30 minutes interval.  var hours = [];     for (let hour = 0; hour < 24; hour++) {       hours.push(moment({ hour }).format('h:mm a'));...
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 ra...
I have a date/time with a timezone and want to convert it into UTC  const date = '2019-04-10T20:30:00Z'; const zone = 'Asia/Kuala_Lumpur'; const utcDate = moment(date).tz(zone).utc().format(); console.log('UTC Date : ', utcDat...
So I'm trying to get various time zones, and I have set up the times, however, the same time is being displayed in all zones.  Here is my code:  const format = 'HH:MM'  // San Francisco - Time let sanFrancisco = moment().tz('Etc/GMT-8...
I'm getting an error using moment-timezone with America/Sao_Paulo trying to parse date with America/Sao_Paulo offset. I've created this code:  const date = "2019-1-1 23:30"; const format = "YYYY-M-D HH:mm"; const timezone = &#...
I have string:  date =  "2019/1/16 00:00 +0900"   I'm in New York (timezone -5), I want to create an Date object like that:  Wed Jan 16 2019 00:00:00 GMT+0900   I can't use javascript to convert. It will return with timezone -5. I use...
I have a quite data-heavy app I'm working on, and I can see in Chrome's profiler that moment is chewing up an enormous amount of CPU when working with large datasets. I'm aware it's reasonably well-known for this, but I don't know...
I am trying to mock moment library's format function using jest. I have following code in my test file.  app.spec.js:  jest.mock('moment', () => {     const moment = () => ({         format: () => mockedTime     });     moment.tz...
somehow i tried to get the timezone of America/New_York (my locale time is -1 hour from EST). But im always getting the same time when i use  moment(new Date()).tz("America\New_York").toDate()   Am i using the wrong method or what happened? C...
I have a date and time in api response. Which I need to convert in user timezone.    datetime: function (datetime) {     return moment(datetime, 'YYYY-MM-DD HH:mm:ss').tz(timeZone).format('MMM Do YYYY, h:mm a'); },   However, the star...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.