TypeError: Cannot read property 'tzname' of undefined when setting timezone to Asia/Bangkok. #16

Closed
dtinth opened this Issue Apr 24, 2012 · 4 comments

Comments

Projects
None yet
2 participants

dtinth commented Apr 24, 2012

When setting the timezone to Asia/Bangkok, it throws:

TypeError: Cannot read property 'tzname' of undefined

The code is like this:

a = new Date();
require('time').extend(a);
a.setTimezone('Asia/Bangkok');
console.log(a.toString()); // error

However, setting it to different timezone that works first, then set to Asia/Bangkok makes it work:

a = new Date();
require('time').extend(a);
a.setTimezone('UTC');
a.setTimezone('Asia/Bangkok');
console.log(a.toString()); // error
Owner

TooTallNate commented Apr 24, 2012

Your example works for me:

~/node-time (master) ⚡ cat t.js 
a = new Date();
require('./').extend(a);
a.setTimezone('Asia/Bangkok');
console.log(a.toString()); // error
☮ ~/node-time (master) ⚡ node t.js 
Tue Apr 24 2012 10:09:32 GMT+0700 (ICT)

Strange...

Owner

TooTallNate commented Apr 24, 2012

Can you verify that the file /usr/share/zoneinfo/Asia/Bangkok (the location of the "zoneinfo" dir might be different on your playform) actually exists?

dtinth commented Apr 24, 2012

Yes, it does exist. I'm running it on Mac OS X 10.7, by the way.

Owner

TooTallNate commented Apr 24, 2012

@dtinth Can you try the v0.8.1 release? It should be fixed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment