Skip to content

moment.tz.setDefault()  #29

@cfaherty

Description

@cfaherty

Hi. The 2.0 BETA will call moment.tz.setDefault(userFormatOptions.timezone), for example in getAvailabilities().

There is a bit of a SNAFU with moment-tz in that setDefault will change all moment modules to that timezone. This affects the use of all moment modules. Hence, calling getAvailabilities() will affect the use of moment() throughout the project. For example, check moment().utcOffset() before and after the call. It normally would reflect your browser's timezone, but after getAvailabilities() it will reflect the parseTimezone option.

https://momentjs.com/timezone/docs/#/using-timezones/default-timezone/
moment/moment#3754

Not sure of the best remedy. Perhaps call moment.tz.setDefault() afterwards to reset it? Or maybe setDefault() is too dangerous to use.

Metadata

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