Passing date through Date ruins Timezone #1

Closed
clintandrewhall opened this Issue Apr 14, 2011 · 3 comments

Comments

Projects
None yet
4 participants
Contributor

clintandrewhall commented Apr 14, 2011

I'm using a Timezone binding for Node that allows for Timezone creation:

https://github.com/TooTallNate/node-time

Unfortunately, the line:

// Passing date through Date applies Date.parse, if necessary
date = date ? new Date(date) : new Date;

resets this Date implementation to the local timezone, or that of the server. I don't see a problem with:

// Passing date through Date applies Date.parse, if necessary
if(!date || !(date instanceof Date)) {
  date = date ? new Date(date) : new Date;
}

... does anyone disagree?

Owner

felixge commented Apr 16, 2011

How about:

date = date || new Date;
if(!(date instanceof Date)) {
  date = new Date(date);
}

If I can get a pull request for that, it's in : )

What's up ? Corrected or not ?

Collaborator

ctavan commented Sep 4, 2014

I guess this is obsolete. node-dateformat doesn't really play nice with timezones you should use a more sophisticated library such as moment.js instead (see also #21).

@ctavan ctavan closed this Sep 4, 2014

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