Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Mark Carpenter Jr
    @mcarpenterjr
    Do you know what version of moment the proxyquire server is requiring? The docs state that moment-timezone depends on moment 2.9.0+. Could also be a bug in between 2.9 and the current release, if the deps haven't been updated.
    jacobg
    @jacobg

    The docs say the following:

    Note: if you chain multiple actions to construct a date, you should start from a year, then a month, then a day etc. Otherwise you may get unexpected results, like when day=31 and current month has only 30 days (the same applies to native JavaScript Date manipulation), the returned date will be the 30th of the current month (see month for more details).
    
    Bad: moment().date(day).month(month).year(year)
    
    Good: moment().year(year).month(month).date(day)

    Based on that information I would expect:
    moment().year(2018).month(3).date(31).format()
    To print: "2018-04-30T13:20:40-04:00”
    But instead it prints: "2018-05-01T13:20:40-04:00”
    Why?

    Ivo Raisr
    @ivosh
    I am seeing weird test failures for all locales, when run with 'grunt test'. The environment has been setup as per CONTRIBUTING.md. Here is one manifestation of this problem:
    Died on test #1 at global.test.QUnit.test (/home/iraisr/moment/node_modules/node-qunit/lib/child.js:133:21)
    at /home/iraisr/moment/build/umd/test/locale/cs.js:553:5
    at test (/home/iraisr/moment/build/umd/test/locale/cs.js:4:43)
    at Object.<anonymous> (/home/iraisr/moment/build/umd/test/locale/cs.js:7:2)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32): undefined$S is not defined
    ReferenceError: undefined$S is not defined
    at prepareConfig (/home/iraisr/moment/build/umd/moment.js:2560:43)
    at createFromConfig (/home/iraisr/moment/build/umd/moment.js:2544:44)
    at createLocalOrUTC (/home/iraisr/moment/build/umd/moment.js:2631:16)
    at createLocal (/home/iraisr/moment/build/umd/moment.js:2635:16)
    at hooks (/home/iraisr/moment/build/umd/moment.js:12:29)
    at Object.<anonymous> (/home/iraisr/moment/build/umd/test/locale/cs.js:554:22)
    I was not able to find anywhere how those 'undefined$..' variables are constructed...
    Ivo Raisr
    @ivosh
    This problem manifests also in CI-Travis builds, for example:
    https://github.com/ivosh/moment/pull/1/checks?check_run_id=4681503
    Robert Stiffler
    @stifflerus
    I'm seeing behavior with the .isAfter() method that I'd like to confirm is unexpected before I make a bug report. It looks like the comparison with day-granularity (moment1.isAfter(moment2, 'day')) depends upon the locale of moment1 to determine if the day number is equal.
    for example
    moment(new Date('2018-07-03T03:00:00.000Z')).isAfter(new Date('2018-07-03T00:00:00.000Z'), 'day') //false
    this is false because my locale is GMT-4 so '2018-07-03T03:00:00.000Z' is actually Jul 02 in my locale
    Robert Stiffler
    @stifflerus
    moment(new Date('2018-07-03T04:00:00.000Z')).isAfter(new Date('2018-07-03T00:00:00.000Z'), 'day') //true
    However, if I set UTC mode, the result changes
    moment(new Date('2018-07-03T04:00:00.000Z')).utc().isAfter(new Date('2018-07-03T00:00:00.000Z'), 'day') //false
    Kodie Grantham
    @kodie
    Hi! I've posted on here before and also on GitHub and have gotten zero responses. I'd really like to update my plugin along with another plugin of mine but I need some input regarding this: moment/momentjs.com#439
    sweetyv
    @sweetyv
    Hi Guys
    anybody here?
    Neil Stevens
    @StickNitro
    Is there anyway to set the meridian on a moment object
    Scott O'Toole
    @scottiedog45
    Weird bug: I'm developing a phone gap app, and I'm able to reference moment if I spin it up in the browser. However, when I run it on device or an iOS simulator, moment is not defined. What's deal?
    Disclaimer: I'm not a super advanced developer, so I may be missing something completely unrelated to moment.
    This is probably related... now I'm just looking for a solution: As of version 2.10.0, the moment global is no longer available if a module system is detected. This was previously working in 2.9.0.
    gregorysl
    @gregorysl

    Hey, I have a small problem with formatting output moment string what I want to do is
    1) parse string I have (always like this: 2013W06 # Basic (short) week only)
    2) substract 1 week
    3) display in same format

    Is there anything better than doing it parsed.format('YYYY[E]w') ?

    Franky82dev
    @Franky82dev
    hello i have the follow timestring (00:15:00, HH:mm:ss) and i want to get (15 min) how can i do that?
    Eder Gomez
    @Ederagp
    @Franky82dev you have to format moment().format("mm") //minutes
    Franky82dev
    @Franky82dev
    @Ederagp thx for help
    svsnarayanan
    @svsnarayanan
    Hi there
    My input is 2018-05-31T21:10:54.010Z, i want to convert this into PDT time-zone
    let formattedDate = moment.tz("2018-05-31T21:10:54.010Z", "America/Los_Angeles");
    tooltipValue = formattedDate.format("MM/DD/YYYY [at] HH:mm:ss z");
    svsnarayanan
    @svsnarayanan
    any help would be highly appreciated, thank you!
    svsnarayanan
    @svsnarayanan
    Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
    Chris
    @this-chris

    Hey, I have a problem with .diff(). following tests are failing

    t.is(moment([2019, 9, 30]).diff(moment([2018, 7, 31]), 'months', true), 14); // returns 13.96774193548387
    t.is(moment([2019, 2, 28]).diff(moment([2018, 8, 30]), 'months', true), 6); // returns 5.933333333333334

    I found something similar in the issue moment/moment#3029. Any clue why this returns the wrong diff? Do I miss something? thanks (using version 2.22.2)

    Tiago Magalhães
    @tiagomsmagalhaes
    Hello.. Can I make a feature request (because may not be an issue) by opening an issue?
    Ryan Ragle
    @rtragle
    Are moment timestamps always in utc?
    Aaron Beall
    @aaronbeall
    Given a moment datetime format, like dateFormat = "MMM YYYY" is it possible to see what the parsed tokens are? For example with "MMM YYYY" I want to know it contains [month, year]
    I know I could use regexp against all the documented display format options
    Luis Ruiz
    @newmesiss
    hello friends, I'm comparing 2 dates that is composed in this way "dd-mm-yyyy" but moment is taking it as "mm-dd-yyyy", how can I configure it to read me in the order I need it? moment('08/05/2018', 'DD/MM/YYYY').isSameOrAfter('01/09/2018','DD/MM/YYYY');
    Brad Wertman
    @bmwertman
    import moment from "moment" in my React app. But I get an error "moment is not defined" when calling moment(). Is there something different I have to do to import moment vs every other node module I'm using?
    Sameer Siddiqui
    @SameerSiddiqui
    p0y0m0dt0h0m0s What is this time format called ?
    how i can convert dateTime in to above is there a func avail in moment ?
    Eder Gomez
    @Ederagp
    @bmwertman try import * as moment from "moment"
    Keegan
    @Keggatron
    Hey guys, anyone know if it's possible to show a separate month date if and only if the month changed in the time interval. ie Nov 11 - 17, but if a month changes during any week interval to then show the month? ie Nov 25 - Dec 1
    Joseph Maxim
    @josephmaxim
    After adding moment.js client side in my react app my build load time tripled. is it not recomended to use clioentside?
    Raja Simon
    @rajasimon_gitlab
    const result = currentTime.to(startTime); // In a day

    But I need to know exact days, hours, minutes, seconds like this 3, 18, 55, 60

    How do I achieve this? Hey by the way it's awesome library.

    Eder Gomez
    @Ederagp
    @rajasimon_gitlab you can use:
    moment(datetime).format("DD"); // result day
    moment(datetime).format("MM"); // result month
    moment(datetime).format("YYYY"); // result year
    moment(datetime).format("HH"); // result hour
    moment(datetime).format("mm"); // result minutes
    moment(datetime).format("ss"); // result seconds
    Raja Simon
    @rajasimon

    @Ederagp Thanks for your valuable answer but in your answer you used datetime to convert into desirable format. In my case I've two datetime and I need to know the time difference between two datetime in the format of ( years, months, dates, hours, minutes).

    const currentTime // Moment {_isAMomentObject: true, _i: "2018-11-24T10:00:00+05:30", _f: "YYYY-MM-DDTHH:mm:ssZ", _tzm: 330, _isUTC: false, …}
    const startTime // Moment {_isAMomentObject: true, _i: Fri Nov 23 2018 13:41:56 GMT+0530 (India Standard Time), _isUTC: false, _pf: {…}, _locale: Locale, …}

    Now that I know currentTime and startTime and I need to know the time difference and after digging through the momentJs docs I found that I can use to like this

    const result = currentTime.to(startTime) 

    but above code return In a day but what I want is years, months, hours, minutes, seconds Please help me to understand how to get this desirable format what I want.

    Eder Gomez
    @Ederagp
    @rajasimon since you know currentTime and startTime you can use, as explained in moment().diff():
    moment().diff(Moment | String | Number | Date | Array);
    Obtaining the difference can pass the unit of measurement required days, month, year, hour, minutes, seconds:
    a.diff(b, 'years');
    a.diff(b, 'days');
    Francis Rodrigues
    @francisrod01
    What's the best way to create a JS class/component (if use React) to reuse a moment instance?
    adrianwood
    @adrianwood
    Is there a reason why the latest versions of spam-moment are not published to NPM?
    *spm
    Joel Costa
    @joelrfcosta
    @mj1856 on moment/moment#1407 you said to talk with you so here it goes :)
    Is there any way to disable the warning during tests?
    Joel Costa
    @joelrfcosta
    Ok, found out how to do it right: moment.utc(dateString, moment.ISO_8601, true). Thanks :)