For a framework I'm working on I tried packaging moment-with-locales.js and moment-timezone.js together. All the locale stuff works fine but when i try to use the tz function to set the timezone I get and error that tz does not exist.
This also occurs when I just load the scripts separately.
If I run straight up moment.js and timezones tz works.
Is there any reason why I can't run the locales with timezone? I have timezone 0.2.2 and moment 2.8.3
I am having this issue also. Any workaround so that we can use both of these? I think the problem is with moment-timezone. It is looking for another version of moment in the environment and cannot find it (or something like that).
You have to create a shim for the moment.js when you define them in require.js. In both moment.js and moment with locales you have the moment object define. Timezone is a standalone with no basic moment included. But you can't just include the moment or moment with locales. You have to shim the moment define in the require.js definition and export the Moment object from the momentjs class.
Kevin
----- Original Message -----
From: "kaizenmantra" [email protected]
To: "moment/moment-timezone" [email protected]
Cc: "Regan, Elyssa" [email protected]
Sent: Sunday, November 23, 2014 4:39:43 PM
Subject: Re: [moment-timezone] Issues trying to run moment-with-locales.js and moment-timezone together (#143)
I am having this issue also. Any workaround so that we can use both of these? I think the problem is with moment-timezone. It is looking for another version of moment in the environment and cannot find it (or something like that).
—
Reply to this email directly or view it on GitHub .
This needs a documented example.
If this is undocumented, happy to take a pull.
This needs a workable solution. I'm not a frontend developer and have NFI how to get this working with babel and brunch, so crowdsourcing would be waiting for Godot. script tags for locale and with tzdata work fine, but we absolutely cannot use that because it doesn't work with the asset compiler.
@steakknife at the end of the day these are both UMD modules. The JS ecosystem currently has approximately 700 billion ways to use UMD modules. As a team, we aren't able to do anything but crowd source - I can tell you how to use it with grunt, and with webpack, but that's it because that's all I personally use.
We've found a solution. Thanks a brunch!
On Tue, May 16, 2017 at 11:13 AM Maggie Pint notifications@github.com
wrote:
@steakknife https://github.com/steakknife at the end of the day these
are both UMD modules. The JS ecosystem currently has approximately 700
billion ways to use UMD modules. As a team, we aren't able to do anything
but crowd source - I can tell you how to use it with grunt, and with
webpack, but that's it because that's all I personally use.—
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
https://github.com/moment/moment-timezone/issues/143#issuecomment-301868666,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AANsMGdqc4uA0TIEluy5KCGfuNXj-Am7ks5r6ec2gaJpZM4Czadq
.
@steakknife . can you please help to share the solution. we are facing same issue.
we are having an issue that is probably like this.
I need to use timezones and localized formatting in the same .js file. Right now I need to do like this:
import tzmoment from 'moment-timezone';
import moment from 'moment';
and then use tzmoment and moment as standalone packages: tzmoment to parse timezones and moment to format dates to localized output.
Is it possible to "merge" imports somehow, so that I would need to import only moment-timezone and use localized formatting?
+1