Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Date object not returning the correct locale time
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
james33  
View profile  
 More options Apr 9 2012, 12:49 am
From: james33 <jame...@gmail.com>
Date: Sun, 8 Apr 2012 21:49:14 -0700 (PDT)
Local: Mon, Apr 9 2012 12:49 am
Subject: Date object not returning the correct locale time

I'm running node 0.6.14 on a Joyent machine (OS is a varient of Solaris).
The timezone is set to US/Central, but the Date object in node doesn't seem
to recognize this. Below are the outputs of a few different console.logs:

*process.env.TZ*: 'US/Central'

*new Date()*: 'Mon, 09 Apr 2012 04:45:28 GMT'

*new Date().toLocaleString()*: 'Mon Apr 09 2012 05:45:28 GMT+0100 (CST)'

The current US/Central time is actually 'Sun Apr 08 2012 23:45:28 GMT -0500
(CDT)'. Is this a bug or am I doing something wrong?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Patenaude  
View profile  
 More options Apr 9 2012, 1:07 am
From: Matt Patenaude <m...@mattpatenaude.com>
Date: Mon, 9 Apr 2012 01:07:45 -0400
Local: Mon, Apr 9 2012 1:07 am
Subject: Re: [nodejs] Date object not returning the correct locale time

Hmm, European CST is GMT+1, it could be using that instead (in spite of the US/ bit there). Try changing to (for example) 'America/Chicago' and see if you get different results?

-Matt

On Apr 9, 2012, at 12:49 AM, james33 wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
james33  
View profile  
 More options Apr 9 2012, 1:56 pm
From: james33 <jame...@gmail.com>
Date: Mon, 9 Apr 2012 10:56:38 -0700 (PDT)
Local: Mon, Apr 9 2012 1:56 pm
Subject: Re: [nodejs] Date object not returning the correct locale time

I still get the same result.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Patenaude  
View profile  
 More options Apr 9 2012, 2:08 pm
From: Matt Patenaude <m...@mattpatenaude.com>
Date: Mon, 9 Apr 2012 14:08:03 -0400
Local: Mon, Apr 9 2012 2:08 pm
Subject: Re: [nodejs] Date object not returning the correct locale time

And what if you pick a completely different timezone, e.g., America/Los_Angeles?

-Matt

Sent from my iPhone

On Apr 9, 2012, at 1:56 PM, james33 <jame...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
james33  
View profile  
 More options Apr 9 2012, 2:32 pm
From: james33 <jame...@gmail.com>
Date: Mon, 9 Apr 2012 11:32:58 -0700 (PDT)
Local: Mon, Apr 9 2012 2:32 pm
Subject: Re: [nodejs] Date object not returning the correct locale time

I get GMT+0100 (PST) with that.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Patenaude  
View profile  
 More options Apr 9 2012, 5:58 pm
From: Matt Patenaude <m...@mattpatenaude.com>
Date: Mon, 9 Apr 2012 17:58:37 -0400
Local: Mon, Apr 9 2012 5:58 pm
Subject: Re: [nodejs] Date object not returning the correct locale time

Just to make sure environmental variables aren't getting messed with somehow, try running this:

        echo "console.log((new Date()).toLocaleString());" | TZ='America/Los_Angeles' node

Should print out a locale string at GMT-0700 (PDT). If it doesn't, then I'd defer to someone else who's more knowledgeable about the internals of Node's Date object than myself. :)

-Matt

On Apr 9, 2012, at 2:32 PM, james33 wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
james33  
View profile  
 More options Apr 9 2012, 6:02 pm
From: james33 <jame...@gmail.com>
Date: Mon, 9 Apr 2012 15:02:02 -0700 (PDT)
Local: Mon, Apr 9 2012 6:02 pm
Subject: Re: [nodejs] Date object not returning the correct locale time

It returns Mon Apr 09 2012 23:01:04 GMT+0100 (PST)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Noordhuis  
View profile  
 More options Apr 9 2012, 7:34 pm
From: Ben Noordhuis <i...@bnoordhuis.nl>
Date: Tue, 10 Apr 2012 01:34:33 +0200
Local: Mon, Apr 9 2012 7:34 pm
Subject: Re: [nodejs] Date object not returning the correct locale time

On Tue, Apr 10, 2012 at 00:02, james33 <jame...@gmail.com> wrote:
> It returns Mon Apr 09 2012 23:01:04 GMT+0100 (PST)

You should report this to V8 because I'm 99% sure it's a bug. To wit,
this is the V8 shell on a Linux or OS X system:

  $ TZ='America/Los_Angeles' out/ia32.release/shell -e 'print(new
Date().getTimezoneOffset())'
  420
  $ TZ='Europe/Amsterdam' out/ia32.release/shell -e 'print(new
Date().getTimezoneOffset())'
  -120

And this is on a Solaris system:

  $ TZ='America/Los_Angeles' out/ia32.release/shell -e 'print(new
Date().getTimezoneOffset())'
  -60
  $ TZ='Europe/Amsterdam' out/ia32.release/shell -e 'print(new
Date().getTimezoneOffset())'
  -60

If I have some time to kill, I'll look into fixing it myself.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
james33  
View profile  
 More options Apr 9 2012, 10:41 pm
From: james33 <jame...@gmail.com>
Date: Mon, 9 Apr 2012 19:41:11 -0700 (PDT)
Local: Mon, Apr 9 2012 10:41 pm
Subject: Re: [nodejs] Date object not returning the correct locale time

Thanks, I've added the issue here:
http://code.google.com/p/v8/issues/detail?id=2064&thanks=2064&ts=1334...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »