Closed mdedetrich closed 11 years ago
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 Web Developer iHeartRadio/Clear Channel Radio
On Oct 12, 2012, at 10:21 PM, mdedetrich notifications@github.com wrote:
Is there an ETA for when this will be fixed (its somewhat urgent for my end)
— Reply to this email directly or view it on GitHub.
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 <mdedetrich@gmail.com>",
"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 Web Developer iHeartRadio/Clear Channel Radio
On Oct 19, 2012, at 10:43 PM, mdedetrich notifications@github.com wrote:
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 mdedetrich@gmail.com", "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 above
— Reply to this email directly or view it on GitHub.
I can't seem to reproduce it. I've added a test for your case in tz.manual.spec.js
in the spec
folder. I'm testing it against master
btw, not 0.4.3
. If the issue doesn't happen in master
then I'll ask @mde to publish a new version 0.4.4
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:
npm install -g jake
jake test:init
jake test
Let me know
Im getting a
Finished in 0 seconds
0 tests, 0 assertions, 0 failures
hmm that's weird. Can you try npm test
then?
Removing old timezone data.
rm -rf lib/tz
Downloading new timezone data ...
Expanding archive ...
Retrieved new timezone data
path.existsSync is now called `fs.existsSync`.
Finished in 0 seconds
0 tests, 0 assertions, 0 failures
I am doing this in the timezone-js node_modules directory
hmm are you sure you got the master
branch? The console output is missing something
Ok, got this
Failures:
1) should take in millis as constructor
Message:
Expected '1970-01-01T01:00:00.000Z' to equal '1970-01-01T00:00:00.000Z'.
Stacktrace:
Error: Expected '1970-01-01T01:00:00.000Z' to equal '1970-01-01T00:00:00.000Z'.
at new jasmine.ExpectationResult (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:102:32)
at null.toEqual (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1171:29)
at null.<anonymous> (/Users/mdedetrich/temp/masterbranch/spec/date.spec.js:113:25)
at jasmine.Block.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1001:15)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at jasmine.Queue.start (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1743:8)
at jasmine.Spec.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2070:14)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at onComplete (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1786:18)
at jasmine.Spec.finish (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2044:5)
2) should take in Date object as constructor
Message:
Expected '1970-01-01T01:00:00.000Z' to equal '1970-01-01T00:00:00.000Z'.
Stacktrace:
Error: Expected '1970-01-01T01:00:00.000Z' to equal '1970-01-01T00:00:00.000Z'.
at new jasmine.ExpectationResult (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:102:32)
at null.toEqual (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1171:29)
at null.<anonymous> (/Users/mdedetrich/temp/masterbranch/spec/date.spec.js:121:25)
at jasmine.Block.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1001:15)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at jasmine.Queue.start (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1743:8)
at jasmine.Spec.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2070:14)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at onComplete (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1786:18)
at jasmine.Spec.finish (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2044:5)
3) should take in millis and tz as constructor
Message:
Expected 3600000 to equal 0.
Stacktrace:
Error: Expected 3600000 to equal 0.
at new jasmine.ExpectationResult (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:102:32)
at null.toEqual (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1171:29)
at null.<anonymous> (/Users/mdedetrich/temp/masterbranch/spec/date.spec.js:128:26)
at jasmine.Block.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1001:15)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at jasmine.Queue.start (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1743:8)
at jasmine.Spec.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2070:14)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at onComplete (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1786:18)
at jasmine.Spec.finish (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2044:5)
4) should take in Date object as constructor
Message:
Expected 3600000 to equal 0.
Stacktrace:
Error: Expected 3600000 to equal 0.
at new jasmine.ExpectationResult (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:102:32)
at null.toEqual (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1171:29)
at null.<anonymous> (/Users/mdedetrich/temp/masterbranch/spec/date.spec.js:135:26)
at jasmine.Block.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1001:15)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at jasmine.Queue.start (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1743:8)
at jasmine.Spec.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2070:14)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at onComplete (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1786:18)
at jasmine.Spec.finish (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2044:5)
5) should be able to clone itself
Message:
Expected 3600000 to equal 7200000.
Stacktrace:
Error: Expected 3600000 to equal 7200000.
at new jasmine.ExpectationResult (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:102:32)
at null.toEqual (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1171:29)
at null.<anonymous> (/Users/mdedetrich/temp/masterbranch/spec/date.spec.js:207:26)
at jasmine.Block.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1001:15)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at jasmine.Queue.start (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1743:8)
at jasmine.Spec.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2070:14)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at onComplete (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1786:18)
at jasmine.Spec.finish (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2044:5)
6) should be able to clone itself
Message:
Expected '1969-12-31 19:00:00' to equal '1969-12-31 20:00:00'.
Stacktrace:
Error: Expected '1969-12-31 19:00:00' to equal '1969-12-31 20:00:00'.
at new jasmine.ExpectationResult (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:102:32)
at null.toEqual (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1171:29)
at null.<anonymous> (/Users/mdedetrich/temp/masterbranch/spec/date.spec.js:208:27)
at jasmine.Block.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1001:15)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at jasmine.Queue.start (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1743:8)
at jasmine.Spec.execute (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2070:14)
at jasmine.Queue.next_ (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
at onComplete (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1786:18)
at jasmine.Spec.finish (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2044:5)
Finished in 3.465 seconds
51 tests, 130 assertions, 6 failures
jake aborted.
Error: Process exited with error.
at fail (/usr/local/lib/node_modules/jake/lib/api.js:221:18)
(See full trace by running task with --trace)
What node version were you using? Also what timezone and OS?
Node version is v0.8.6 OS is Mac OSX Lion 10.8.2 My timezone is 'Australia/Sydney'
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 jasmine-node spec/tz.manual.spec.js
Ok, running jasmine-node spec/tz.manual.spec.js gives me this
Finished in 0.035 seconds
1 test, 6 assertions, 0 failures
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 notifications@github.com wrote:
@mde https://github.com/mde it's been a while since we up'ed the package can we do that?
— Reply to this email directly or view it on GitHubhttps://github.com/mde/timezone-js/issues/46#issuecomment-9856547.
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