Skip to content

Timezone not accesible after upgrading to version 9 #370

Open
@jasalguero

Description

Hi, I'm upgrading some application's ember versions and after upgrading to the lastest ember-moment (9.0.1) I get error while trying to access the timezone. It works fine reverting back to ember-moment 8x

ember -v

ember-cli: 3.28.5
node: 14.16.0
os: darwin x64`

npm list

...
│ ├── moment@2.29.1 deduped
│ └── moment-timezone@0.5.34 ded
...
//config.environment

module.exports = function() {
  return {
    moment: {
      // Options:
      // 'all' - all years, all timezones
      // 'subset' - 2012-2022, all timezones
      // 'none' - no data, just timezone API
      includeTimezone: 'subset'
    }
  }
};

Trying to use the .tz in the code throws an exception

import moment from 'moment';

export const convertDateToUTC = (
  date,
  timezone,
  format = 'MM/DD/YYYY HH:mm'
) => {
  return moment(date, format).tz(timezone, true).toJSON();
};

Throws: TypeError: (0 , _moment.default)(...).tz is not a function

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions