Issue in timezone with Node.js Module 'time'

I just came across an issue that has happened today (due to being 31st of January here in Australia Sydney). Basically, given a year,date,hour,minute,second. I want to create a date as if I am in a timezone (Australia/Sydney) and then convert it to UTC (i.e. getting the milliseconds).

This is done due to the fact that the database (and the server) works in UTC, where as the client can be in any given timezone (when a post request is done, the client provides both the timezone and the year,month,date,hour,minute,second values)

The problem is, that when I am creating a date for today, its throwing off the date all the way back to January the 3rd of this month, here is the code that illustrates the problem

var scheduled, someTime, time, timeinfo, timezone;
process.env.TZ = 'UTC';
time = require('time');

timeinfo = {
    hour: 14,
    minute: '47',
    year: 2013,
    month: 1,
    date: 31
};

timezone = 'Australia/Sydney';
someTime = new Date(timeinfo.year, timeinfo.month - 1, timeinfo.date, timeinfo.hour, timeinfo.minute, 1, 1);
scheduled = time.Date(timeinfo.year, timeinfo.month - 1, timeinfo.date, timeinfo.hour, timeinfo.minute, 1, 1, timezone);
console.log(someTime);
console.log(scheduled);

When you run this in Node.js, the time outputted by console.log(scheduled); is completely off.

Note: I am using the time npm library.

Seems to be a bug with how node-time calculates timezones, related to the order of the operations when doing the transform. There's an open issue (#28) on github.com as of now.

I have submitted a pull request, try that in the mean-time and see if it works for your particular case.

Please try the following codes

1.For GMT Time

var GMTtimeObj = new Date();

2.For UTC Time:

var UTCtimeObj = +new Date();

Let me know does it works for your requirement.

Go through this post's answers as well it might help you..

This was a bug that was fixed recently, please look at https://github.com/TooTallNate/node-time/pull/30

Its working perfectly now