adopted-ember-addons/ember-moment

Timezone not accesible after upgrading to version 9

jasalguero opened this issue · 2 comments

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

I tried also with a clean new Ember app (v4), just installing ember-moment and trying to access the timezone throws the exception