Comments (10)
hmm you can use JSONP if you don't wanna deal w/ CORS stuff. Can you clarify your proposed method a bit?
from timezone-js.
something like:
<script src="all-cities-tz-data.js" /> <script src="timezone-js/date.js" /> <script> $(document).ready(function(){ timezoneJS.timezone.parseJsonData( tzData ); }); </script>
where all-cities-tz-data.js is an assignment of the node-parse.js generated data to an variable:
var tzData = { zones: { .... };
As in symfony2, I can "concatenate" the above 2 js files into one, with its "Assetic" bundle, these 2 js files will finally require only ONE requests. And this request can be fetched from another "origin".
I have no experience on JSONP so my suggestion here may not be good enough, this is just for a reference.
Simon
from timezone-js.
hmm my suggestion would be what you've already had right now, which is pre-processed static data (minified and gzipped) and send everything down as 1 min.js to avoid extra asset loading requests.
During the pre-process stage you can embed JSON no problem.
from timezone-js.
I see. Thanks for your info. Right now, I couldn't find any "parseJsonData()" like function to call, so I'm using it with an extra "sync" request now. But it has some other errors reported, let me write them in a separate issue.
from timezone-js.
hmm have you tried loadZoneDataFromObject
?
from timezone-js.
Oh I didn't. Thanks for your reminder. Finally I got it work with:
timezoneJS.timezone.loadingScheme = timezoneJS.timezone.loadingSchemes.MANUAL_LOAD; timezoneJS.timezone.loadZoneJSONData('/tz/all-tz.json', true);
but if I change the above "true" to "false", I got error:
hms is null
from timezone-js.
hmm I'll try to take a look at it. Can u throw in a bug report for it? Did loadZoneDataFromObject
work for your use case?
from timezone-js.
I think I'm not going to use loadZoneDataFromObject for now. loadZoneJSONData() now works well for me (with sync=true). Thanks.
from timezone-js.
Cool :) Tks
from timezone-js.
Thank you :D
btw, reported the above "hms is null" in #68
from timezone-js.
Related Issues (20)
- setTime unable to progress over DST start (NZST to NZDT) HOT 1
- Invalid region for some timezones HOT 4
- Browserify require timezone-js raise uncaught error HOT 4
- getTimezoneOffset() does not work with DST HOT 2
- Does not work with UTC reliably around DST changes in local timezone HOT 3
- date.setMonth() on a date outputs wrong month HOT 5
- Error: Timezone 'Europe/Copenhagen' is either incorrect, or not loaded in the timezone registry. HOT 1
- Timezone incorrect or not loaded in the timezone registry HOT 1
- incorrect timezone abbreviations HOT 2
- DST problem after upgrading HOT 1
- toISOString returns incorrect value near (but not during) DST change HOT 1
- Incorrect time transition moment HOT 1
- timezoneJS constructor returns wrong offset and timezone HOT 1
- tzdata now available as NPM modules HOT 3
- invalid date HOT 1
- missing timezone names HOT 1
- Error while setting up with Olson files (missing file) HOT 1
- Failure for years < 100 AD HOT 3
- Wrong date conversion for certain years in daylight saving time HOT 1
- Wrong Date conversion for the years below 1947 in Kuwait Timezone(UTC+3). HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timezone-js.