Closed codefuze closed 11 years ago
can u post a code snippet? You have to specify tz lib data with
timezoneJS.timezone.zoneFileBasePath = '/tz';
timezoneJS.timezone.defaultZoneFile = ['asia', 'backward', 'northamerica', 'southamerica'];
timezoneJS.timezone.init();
as specified in the docs. Let me know if it doesn't work.
I have specified the data. Here is a code snippet:
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="js/timezone-js/src/date.js"></script>
<script>
$(document).ready(function(){
timezoneJS.timezone.zoneFileBasePath = 'tz';
timezoneJS.timezone.defaultZoneFile = ['northamerica'];
timezoneJS.timezone.init();
/*** My Code Here ***/
var ct = new timezoneJS.Date(year, month, day, hours, mins, 'America/Chicago');
});
</script>
It will not load the data. Any thoughts?
Oh try turning off async with init({async: false})
. Otherwise you'll need a callback.
Long Ho Web Developer iHeartRadio/Clear Channel Radio
On Nov 23, 2012, at 6:05 PM, codefuze notifications@github.com wrote:
I have specified the data. Here is a code snippet:
It will not load the data. Any thoughts?
— Reply to this email directly or view it on GitHub.
Thanks! That was it.
+1 Worked great for me.
Same here, without it this sample won't work, glad I reached this page
timezoneJS.timezone.zoneFileBasePath = path.join( __dirname, 'tz'); timezoneJS.timezone.loadingScheme = timezoneJS.timezone.loadingSchemes.PRELOAD_ALL; timezoneJS.timezone.init({async: false}); console.log( timezoneJS.timezone.zoneFiles.length); <- this would be 10 even if it is not yet loaded and available var dt = new timezoneJS.Date(2013, 0, 1, 'America/Juneau'); console.log( dt);
just added clarification to the README :) Hope that helps
Hi all,
I keep getting this in my console while using timezone.js :
warning : Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
error: GET http://exodo/tz/asia 404 (Not Found)
error : Uncaught TypeError: Cannot read property '1' of null
// code snipet timezoneJS.timezone.zoneFileBasePath = 'tz'; timezoneJS.timezone.defaultZoneFile = ['asia', 'backward', 'northamerica', 'southamerica']; timezoneJS.timezone.init({ async: false }); var dt = new window.timezoneJS.Date(new Date()); console.debug(dt.toString()); dt.setTimezone('America/Los_Angeles'); alert(dt);
Just found the solution. The list of Olson files where missing in /tz folder.
I am trying to get this to work with JQuery. I get the following error:
The readme states I would need too create a custom transport method. Could anyone give an example on how I would do this or create a wiki for it. Sorry to create an issue, this has been driving me crazy!