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

How to correctly link moment and moment-timezone #11

Closed
jj-julia opened this issue Aug 12, 2019 · 4 comments
Closed

How to correctly link moment and moment-timezone #11

jj-julia opened this issue Aug 12, 2019 · 4 comments

Comments

@jj-julia
Copy link

jj-julia commented Aug 12, 2019

I am trying to use the timezone feature https://api.highcharts.com/highcharts/time.timezone
What is the best way to import moment and moment-timezones?
Currently I am importing the scripts from a CDN in the index.html file (see below). It works, however, every time I navigate away and return the timezone reverts to the UTC. Am I approaching this in the wrong way?

Thanks

<html>
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" />
		<link rel="stylesheet" type="text/css" href="css/styles.css" />
	</head>
	<body>
		<div id="container" style="width: 100%; display:flex;flex-direction: column;"></div>
		<script type="text/javascript" src="js/moment-timezone-with-data-2012-2022.min.js"></script>
		<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
		<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.13/moment-timezone-with-data-2012-2022.min.js"></script>
	</body>
</html>

@sebastianbochan
Copy link
Contributor

Hi @jj-julia,
Probably the file moment-timezone-with-data-2012-2022.min.js is not loaded, because you try to do load it from local file system. Try to use the global url (like cdn).

@jj-julia
Copy link
Author

Unfortunately I cant use the CDN because we are building an offline first app. I ended up modifying the wrapper to load them there instead. The reason was that the order the files loaded varied on the second load, causing it to fail second time around.

@SaeedZhiany
Copy link

@sebastianbochan
I had this question too. by default, all highcharts, jquery, and other required libraries will download in every webview. is there any way to put and used them locally. in case of fully offline usages?

@sebastianbochan
Copy link
Contributor

Hi @SaeedZhiany,
All files are loaded locally, not from CDN. As a result, the app will work offline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants