-
Notifications
You must be signed in to change notification settings - Fork 182
Error when using .json file for timezone data #46
Comments
Thanks for reporting I'll take a look :) |
Is there an ETA for when this will be fixed (its somewhat urgent for my end) |
Will try to do it this weekend. If u have a patch feel free to submit a pull request. Long Ho On Oct 12, 2012, at 10:21 PM, mdedetrich [email protected] wrote:
|
Sorry I've been busy. Can you provide a complete workflow for this use case? What steps did you take? What did you mean by "setting a timezone"? |
So basically, I followed the steps here to get the tzdata # Create the /tz directory
mkdir tz
# Download the latest Olson files
curl ftp://ftp.iana.org/tz/tzdata-latest.tar.gz -o tz/tzdata-latest.tar.gz
# Expand the files
tar -xvzf tz/tzdata-latest.tar.gz -C tz
# Optionally, you can remove the downloaded archives.
rm tz/tzdata-latest.tar.gz I then downloaded the date.js and node-preparse.js files into a single directory, and ran node node-prepare.js to generate a tz.json file (which I uploaded and linked to before). I then placed the tz.json file in the same directory as a node project to test out the timezone-js, library. The package.json file is this {
"name": "date-test",
"version": "0.0.1-114",
"author": "Matthew de Detrich <[email protected]>",
"private": true,
"engines": {
"node": ">= 0.6.0"
},
"dependencies": {
"moment" : "1.7.2",
"timezone-js": "0.4.3"
}
} I then created a coffee file as detailed below moment = require 'moment'
timezoneJS = require 'timezone-js'
fs = require 'fs'
_tz = timezoneJS.timezone
_tz.loadingScheme = _tz.loadingSchemes.MANUAL_LOAD;
timezoneJS.timezone.transport = (opts)->
fs.readFileSync(opts.url, 'utf8')
_tz.loadZoneJSONData('tz.json', true);
dt = new timezoneJS.Date()
dt.setTimezone('America/Chicago')
console.info dt And ran it with coffee test.coffee as per normal, and I get the error message described in the original post. Im 99% sure its due to how the tz.json file data is being parsed, maybe something has changed since then? |
Thanks a lot. It's prob sth to do with its internal cache. I'll try to debug it. Long Ho On Oct 19, 2012, at 10:43 PM, mdedetrich [email protected] wrote:
|
I can't seem to reproduce it. I've added a test for your case in |
I have just installed jake, how do you use jake to run the tests (I am reading the documentation however you don't seem to have any tests per say?) |
What you can do is:
Let me know |
Im getting a
|
hmm that's weird. Can you try |
I am doing this in the timezone-js node_modules directory |
hmm are you sure you got the |
Ok, got this
|
What node version were you using? Also what timezone and OS? |
Node version is v0.8.6 |
Hmm interesting. It seems to be another bug then, but the manual test seems to pass on your box, right? |
Well I am not sure, this is the whole output of running the tests (https://gist.github.com/7ffcff2add1aba65d106) and it doesn't specify if it ran the manual test or not (I don't use jake so no idea) |
You can try manually running that test |
Ok, running jasmine-node spec/tz.manual.spec.js gives me this
So that seems to have worked |
Could be a bug with Jake's builtin TestTask. It shouldn't step on anything user-defined, but I'll make sure. |
Nope, doesn't appear to be that. I'll take a look anyway and see why the tests don't run. |
Might be a bug in Chrome/V8 itself, since Firefox current tz in Australia is EDT, but for Chrome/V8 it's EST. |
Isn't the point of timezone-js is that its completely architecture independent? (in which case user defined settings should not make a difference) |
timezone-js is a layer on top of Date, which is JS-engine-dependent so it'd be very hard to be architecture-independent unless it talks to OS-level clock libraries. |
Is there an eta on when the package will be updated on npm? |
@mde it's been a while since we up'ed the package can we do that? |
v0.4.4 just published to NPM. On Sun, Oct 28, 2012 at 10:14 PM, Long Ho [email protected] wrote:
|
I can confirm that the latest updated solved the problem, thanks! |
When using a .json file for timezone data instead of a folder generated through the
command, I get the following error when setting a timezone
600 happens to be the timezone for 'Pacific/Honolulu'. It appears that when the JSON file is parsed, timezone-js doesn't appear to convert the objects to a string, they instead remain as objects. Here is the tz.json I am using (that was generated through the above command) https://dl.dropbox.com/u/11630011/tz.json.
Also this is what my transport function looks like
This is being run on the latest version of node.js
The text was updated successfully, but these errors were encountered: