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

Issues trying to run moment-with-locales.js and moment-timezone together #143

Closed
crushred opened this issue Oct 27, 2014 · 11 comments
Closed

Comments

@crushred
Copy link

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

@kaizenmantra
Copy link

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).

@crushred
Copy link
Author

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" notifications@github.com
To: "moment/moment-timezone" moment-timezone@noreply.github.com
Cc: "Regan, Elyssa" crushred@comcast.net
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 .

@skull-squadron
Copy link

This needs a documented example.

@maggiepint
Copy link
Member

If this is undocumented, happy to take a pull.

@skull-squadron
Copy link

skull-squadron commented May 16, 2017

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.

@maggiepint
Copy link
Member

@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.

@skull-squadron
Copy link

skull-squadron commented May 16, 2017 via email

@apogupta
Copy link

@steakknife . can you please help to share the solution. we are facing same issue.

@alexiusp
Copy link

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?

@olastor
Copy link

olastor commented Aug 13, 2020

+1

@gilmoreorless
Copy link
Member

Given the age of this issue, and the high rate of change of dependency managers in the JS ecosystem, this is near impossible to diagnose. If this problem is still happening, it's best to create a new issue with more details.

@gilmoreorless gilmoreorless closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants