Closed itsuryev closed 12 years ago
good idea I'll look into this
timezoneJS.Date should support this already. I've added 2 unit tests in date.spec.js if you wanna take a look and see it that's what you're looking for.
Please note that there is difference between
var dt = new timezoneJS.Date(0);
and
var dt = new timezoneJS.Date(0, 'America/Los_Angeles');
The later one doesn't work (applies to passing timestamp and Date object).
yup that is correct. The whole business of trying to figure out 7 possible constructors is kinda fuzzy. I'll definitely take a look at this.
For now a workaround is that you can setTimezone after initializing timezoneJS.Date object.
Thanks for adding the tests on this. Awesome work.
I've put in the support for the cases you mentioned. Still working on the case timezoneJS.Date(timeString, tz)
since both are strings it gets tricky.
Allow String constructor also in commit e711f49
In the README it states:
In JavaScript we can do following:
This will create new Date objects. Both cases doesn't seem to work with timezoneJS.Date object. We have to do
This may be not an actual issue if it was not planned to support such use case but please consider it as useful feature request then.