Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Daniel Jones
    Sorry the locale is "en" on both
    Daniel Lizik
    anybody else have issues with jordan/amman timezone on safari?
    coming across a very strange bug
    Brad Wertman
    I'm having some trouble with date/time formatting. On my client I use moment(myDateObject).format('h:mm a') and check the output and I have what is expected, something like "7:53 am". I then use my socket.io connection to send that to my Raspberry Pi running on the same network locally and store it in a variable. When my client restarts it emits an event to my Rpi asking for the value to be returned. But what I get back isn't formatted as it was when I sent it. Instead it looks like "2019-02-08T12:53:22.000Z". Do I need to do something extra to grab the formatted date from Moment before sending it?
    kevin olson
    why does this give me March
    @acidjazz Because moment().format('M') returns 2 and months in javascript go from 0 to 11, so 2 represents March.
    Roy Hvaara
    Hi. Is there a way to check if a string is a valid iso8601 duration? (Eg. PT15M -> true, foo -> false)
    moment('2013W065', moment.ISO_8601).isValid(). Check docs to see supported strings.
    kevin olson
    @HeiVask so ill ask since it seems like i have to, why would moment accept a month numeric as not 0-11, but spit out a month numeric as 0-11
    Because moment uses tokens to create instances and format values. For get/set methods it uses real values.
    Arjun Biju
    hi guys
    any way to convert date time to "2018-10-04T11:54:07.000Z" format
    moment("2018-10-04 11:54:000").format("YYYY-MM-DDTHH:mm:ss.SSSSZ")
    results 2018-10-04T11:54:00.0000+05:30 this one
    but i need datetime to be in 2018-10-04T11:54:07.000Z format with z
    Arjun Biju
    some one help me out
    @Arrow66 AFAIK, Zulu is GMT, so can you append it simply as a string? like moment("2018-10-04 11:54:000").format("YYYY-MM-DDTHH:mm:ss.SSS[Z]") :s
    Ihsan Katmer
    hi everyone, i am trying to install moment.js I type npm install moment --save but after I the addition app crashes. any idea?
    Artem Biryukov
    Guys I have a problem with timezones on server
    I have users in my database with a field timezone which I'll utilize later
    The client sends hours in this format to server 19:30 then I take a user and his timezone and convert this time back to UTC
    Since my server is in UTC it's impossible to convert it to 16:30 I suppose
    Aubrey Quinn
    Hi all, can you help me out? When I call this function moment('01-01-2017', 'DD-MM-YYYY').startOf('month').week()
    I get different results even when the locale is the same
    in my project and browser I get 53 but in another browser i get 1 https://stackoverflow.com/questions/55724982/momentjs-returning-a-different-result-in-browser-than-in-karma-unit-test
    Eugene Serkin
    Hey guys, does anybody know, how to use moment-timezone with latest angular?
    Rodo Abad
    Is there a reason why if I do console.log(moment()) in a Node environment that it returns moment(<current data/time>) instead of executing like in a browser environment?
    Where it gives the actual Moment object?
    Hi all,
    i am using moment('2019-05-21T07:05:11.5685421-07:00').format('MM/DD/YYYY HH:MM:SS') function which is giving wrong time as '05/21/2019 08:05:11' even after changing time zone to (UTC-07:00)Mountain Time(US & Canada) . It should be 07:05:11. Please help me out to get the right time.
    Hi all,
    We working on accessibility fixes for client. Bug is role is missing for previous and next button of date picker. We using moment -2.8.3. Please let me know that above issue is fixed or not if fixed in which version.
    Dawid Paweł Sowa
    Hello guys, I need to format duration and I wonder if moment.js can help me with that. I want to have it localized and in different subject so not "time passed: 3 hours 2 minutes 10 seconds"
    but rather "logged out after: 3 hours 2 minutes 10 seconds". Problem is, in different languages you spell these two cases differently (not like in English, where it's the same). Does moment.js has support for something like that, or do you know any other library that might be helpful?
    Dawid Paweł Sowa
    I'm currently leaning towards changing translation so that default moment.js format fits but I wonder if that would be possible
    Vipul Kapoor
    Hi Guys. I'm having a wierd issue. I'm trying to using moment in my custom plugin but I get an error moment is not a function. I've looked around but didn't find a solution. Do I have to do something special for it to work inside a plugin definition?
            console.log(moment()); //works
        $.fn.datepicker = function(options){
            console.log(moment()); //doesn't work
    Dawid Paweł Sowa
    Hello, assigning anonymous function may cause problems with this. Try doing
     $.fn.datepicker = (options) => {
    Niraj Nandish
    Hi i have two var storing two dates and i would like to store the difference (number of days between them) of the 2 days in a third var and im confused on what to use


    const date1 = moment('2000-01-01');
    const date2 = moment('2000-02-01');
    const diff = date2.diff(date1, 'days'); // 31


    How can I go from a time like 8:0 to 08:00 using moment?
    or 17:0 to 17:00
    tried a lot of things and none of them worked
    @kellyprankin moment('8:0', 'H:m').format('HH:mm')
    See https://momentjs.com/docs/#/displaying/format/
    the problem is that sometimes its 17:0
    so 'H:m' does not suffice
    @kellyprankin well maybe you've to prepare the string first: https://codepen.io/heivask/pen/MMPBWw
    Huy Vo
    Can I parse a datetime from for example 2019-07-16T03:20:40.156Z to UTC+07:00?
    Olu Niyi-Awosusi
    Is moment still under active development?
    I have a question
    when using typescript do you also use Moment instead of Date in your models?
    Ikechukwu Eze
    @HeiVask this works moment('17:0', 'H:m').format('HH:mm') // "17:00"
    Ikechukwu Eze
    @bugproof Date works pretty fine
    Andrew Kralovec
    Hey everyone