Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Hi I have this 2/14/2018 5:00 AM and it is timezone -07:00
    the computer is on time zone +04:00
    when I use moment with (2/14/2018 5:00 AM) instead of it seeing it as -07:00 it converts to +04
    how can I tell moment my datetime is 2/14/2018 5:00 AM and it is timezone -07:00
    Manish Chandra
    Hi All
    Manish Chandra
    I am using moment-timezone ver: 0.5.14 and @types/moment-timezone ver: 0.5.4 and json-loader ver: 0.5.7
    Using webpack as build tool
    Server side I am able to use moment-timezone
    but on client side its giving error Uncaught TypeError: Cannot read property 'length' of undefined at addZone (moment-timezone.js:385) at Function.loadData [as load] (moment-timezone.js:456) at Object.hasOwnProperty (index.js:2) at __webpack_require__ (bootstrap 93e619d9be8d81d31053:19) at Object.module.exports (client.bundle.js:10625) at __webpack_require__ (bootstrap 93e619d9be8d81d31053:19) at Object.<anonymous> (driver-header-container.tsx:9) at __webpack_require__ (bootstrap 93e619d9be8d81d31053:19) at Object.<anonymous> (fetch.js:461) at __webpack_require__ (bootstrap 93e619d9be8d81d31053:19)
    Basically with above moment -timezone is not able to read ./data/packed/latest.json
    My web pack config
    Client ---
    ```module: {
    rules: [
    test: /.[t,j]sx?$/,
    exclude: [
    use: [
    loader: 'babel-loader',
    options: {
    presets: ['es2015', 'stage-1'],
    plugins: ['transform-decorators-legacy']
    loader: 'ts-loader',
    options: {
    configFileName: './src/common/ts/amd.es5.tsconfig.json',
    test: /.s?css$/,
    use: ['style-loader', 'css-loader', 'sass-loader'],
                    test: /\.js$/,
                    use: ['react-hot', 'babel-loader'],
                    include: path.join(__dirname, 'vendor')
                    test: /\.(png|jpg|gif|ico)(\?v=\d+\.\d+\.\d+)?$/,
                    use: 'url-loader?limit=100000'
                    test: /\.(eot|com|json|ttf|woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
                    use: 'url-loader?limit=10000&mimetype=application/octet-stream'
                    test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
                    use: 'url-loader?limit=10000&mimetype=image/svg+xml'
                test: /\.json$/,
                loader: 'json-loader',
        ], ```
    Serrver config ---
    module: { rules: [ { test: /\.ts$/, use: [{ loader: 'ts-loader', options: { configFileName: './src/common/ts/cjs.es5.tsconfig.json', }, }], }, { test: /\.json$/, loader: 'json-loader' } ], },
    Manish Chandra
    Any suggestion ?
    Hey people, I have a problem. I think because of the daylight saving changes this weekend moment timezone is not confused and say Moment Timezone has no data for CEST. I try to add it with moment.tz.add(...) and moment.tz.load([...]) but I'm not sure where to add it exactly. I have the latest package of moment and moment timezone and running angular 5. Any suggestions?
    Jeff Voss
    Does anyone know how to use moment to format a date to match this date in JAVA "yyyy-MM-dd'T'HH:mm:ss'Z'"
    Mohit Anand
    Hey, is there a place new comers can discuss ?
    Jon Concepcion

    In my karma test, I am having an issue. any help with this..

    TypeError: Cannot read property 'format' of undefined

    Shane Bruggeman
    Hey folks, trying to use moment-timezone in ember-moment and it's attaching to window.moment instead of the moment loaded through my package.json
    I see it using the window.moment as the moment argument here:
    The else clause there
    (function (root, factory) {
        "use strict";
        /*global define*/
        if (typeof module === 'object' && module.exports) {
            module.exports = factory(require('moment')); // Node
        } else if (typeof define === 'function' && define.amd) {
            define(['moment'], factory);                 // AMD
        } else {
            factory(root.moment);                        // Browser
    }(this, function (moment) {
    If something in ember-moment is importing / requiring in that as a module, how would they specify the arguments?
    Shane Bruggeman
    Don't know a ton about package defining, so I'm at a loss as to how root comes into here. Ideally it would be the moment dependency brought in from ember-moment's npm install
    hello everyone.
    i have a date with timezone, that gets parsed on chrome but firefox fails
    how to fix that ?
    Abayomi Omosehin
    Hello,Pls how can I use moment js in my react app as start date and end date
    how can i achieve the enddate is always greater than the start date
    why would I be getting the deprecation message with the following line of code. I thought the String + format was suppose to remedy the issue. moment.tz('2015:08:20 14:33:20', 'YYYY:MM:DD HH:mm:ss', 'America/New_York') . Also, please not I do not have control over the date format being provide. I know I can convert it myself to 'YYYY-MM-DDTHH:mm:ss' in moment does not show the deprecation message. However, according to the documentation, the line of code should work. Here is the deprecation message I am seeing. "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."
    Raymond Bergen

    Hi all does any one know how to use moment and moment-timezone?
    if i do

    import * as moment from 'moment'
    import { utc } from 'moment-timezone'

    i get utc, is not exported by node_modules/moment-js

    i use rollup
    I am getting below error when installing moment timezone using bower a The "main" field cannot contain minified files
    bower resolved https://github.com/moment/moment-timezone.git#0.5.25
    anyone know how to fix?
    Jack Howard
    seeing behavior I don't terribly understand. loading only a few timezones via moment.tz.load(MOMENT_TZ_DATA);. But seeing a whole host of seemingly unincluded timezones available -- and working -- when I use moment.tz with a timezone. I've also tried looking at moment.tz.names() to see available timezones
    found that tz data may be separate from loading the data manually moment/moment-timezone#369
    Jack Howard
    It seems like this a hack to get around excluding locales, then manually adding them. does anyone else have any suggestions? moment/moment#2416
    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.
    Hey guys... running grunt data with the latest release no longer succeeds. This is because the latest data dump results in a packed\latest.json containing a zone of "Etc/UTC||||" instead of what used to be "Etc/UTC|UTC|0|0|", ... I'm getting a little lost in the code for where the zones are loaded and figured asking the more hands-on devs here would lead to a quicker resolution of the issue so I can complete a PR I'm working on. I guess my question is - could this be due to IANA breaking how the data is formatted, or is this a change that the devs are already aware of and working on fixing?
    whats interesting is that the latest.json committed to code is 2019b - the same as what is being requested as latest, now, but the latest.json that is generated when I run grunt data is fairly significantly different
    I can verify that grunt data:2014d with both the code in the release branch as well as the changes I made to it, so it is definitely a data issue - but again, is this a known issue that the devs are working on or is this an oopsie from IANA
    confirmed adding the following to the very top of function unpack in moment-timezone.js "fixes" the issue
            if (string === 'Etc/UTC||||') {
                string = 'Etc/UTC|UTC|0|0|';
    spoke too soon, npm run test failed 25 assertions
    and we're fixed
    Jonathan Chrisp
    Hi all, is there anyway to define which version of moment you want to use when using moment-timezone? When I import moment-timezone it uses moment version 2.22.2 under the hood. I need to use the latest version (2.24.0) as I'm adding and subtracting an isoWeek which has only been fixed recently.
    Jonathan Chrisp
    I've raised a PR to update the version here: https://github.com/moment/moment-timezone/pull/777/files
    Jonathan Chrisp
    Hey all, does anyone have any feedback on the above? 🙏
    Kan Yilmaz
    Is this channel active still?
    I'm curious about a way in express to do (100s) of time operations for each request where the calculations should be based on the users' timezone. Basically rather than having moment(myDate).tz(timezone) for 100s of places, is there a way to make the setDefault() function work per request rather than per application?
    Domenic Horner
    const moment = require('moment-timezone'); const dateStart = moment().tz("2020-06-01", "Australia/Perth").startOf('day').utc().format("YYYY-MM-DD"); -> getting Moment Timezone has no data for 2019-01-01., i have included moment-timezone, not sure why data is not included?