Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Passing date through Date ruins Timezone #1

Closed
clintandrewhall opened this Issue · 3 comments

4 participants

@clintandrewhall

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?

@felixge
Owner

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 : )

@kane-thornwyrd

What's up ? Corrected or not ?

@ctavan
Collaborator

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.