Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.19.1: can no longer combine moment, moment-timezone and moment-business-days #4236

jkudish opened this issue Oct 12, 2017 · 7 comments


Copy link

@jkudish jkudish commented Oct 12, 2017

I used to be able to combine moment, moment-timezone, moment-business-days (and moment-range but that one isn't a problem in this situation), like so:

import 'moment-timezone';
import moment from 'moment-business-days';
import { extendMoment } from 'moment-range';

moment.locale('en-us', {
    week: {
        dow: 1, // Monday is the first day of the week
    holidays: [
    holidayFormat: 'YYYY-MM-DD',

export default extendMoment(moment);

This worked in all versions before upgrading to 2.19.1. Now I get the following error:

Uncaught TypeError: Cannot read property 'setDefault' of undefined

And i traced it down to no longer getting defined.

The problem is if I import moment from moment-timezone then moment-business-days will no longer work.


Chrome 61 on MacOS 10.12.6
Compiled with webpack

debug output:

Thu Oct 12 2017 12:29:48 GMT-0700 (PDT)
10/12/2017, 12:29:48 PM
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Any ideas?

Copy link

@gtwilliams03 gtwilliams03 commented Oct 13, 2017

I believe I am getting something similar.

Using import moment from 'moment-timezone' on this line:

var deadlineDisplay = moment.duration(deadlineSeconds, "seconds").format("h [hrs], m [min], s [sec]”)

Throws this error:

Uncaught TypeError: _momentTimezone2.default.duration(...).format is not a function

Rolling back to 2.18.1 it works fine.

Copy link

@boblauer boblauer commented Oct 25, 2017

I'm seeing a similar error. moment-timezone should just be adding new methods to moment, and then returning the original moment object. However, something in 2.19.1 is causing moment-timezone to return a completely different instance than moment.

require('moment').version // 2.18.1
require('moment') === require('moment-timezone') // true
require('moment').version // 2.19.1
require('moment') === require('moment-timezone') //false

Copy link

@nadeemja nadeemja commented Oct 28, 2017

Same for both 2.19.0 and 2.19.1

@icambron icambron added the Bug label Nov 16, 2017
Copy link

@ValeryG ValeryG commented Dec 21, 2017

is it going to be fixed any time soon? or is there a known work around for this? staying on 2.18.1 might not be an option much longer...

Copy link

@dfischer0 dfischer0 commented Dec 22, 2019

Are you sure this issue still exists with Moment 2.24.0 & moment-timezone 0.5.26? If I do:

var moment = require('moment-business-days');

I don't seem to have a problem using

Copy link

@marwahaha marwahaha commented May 13, 2020

Please re-open if you still have issues.

@marwahaha marwahaha closed this May 13, 2020
Copy link

@gongAll gongAll commented Jul 27, 2020

This is still an issue, tho.

require('moment').version // 2.24.0
require('moment') === require('moment-timezone') // true

require('moment').version // 2.25.3
require('moment') === require('moment-timezone') // false

require('moment').version // 2.26.0
require('moment') === require('moment-timezone') // false

require('moment').version // 2.27.0
require('moment') === require('moment-timezone') // false

So since version 2.24.0 I cannot set timezones. This is a real bummer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants