Skip to content

Date.current V/S Date.today

November 1, 2013

I recently hit some strangeness when working with Rails:

(rdb:1) Date.yesterday
Thu, 31 Oct 2013
(rdb:1) Date.today
Thu, 31 Oct 2013
(rdb:1) Date.tomorrow
Sat, 02 Nov 2013
Turns out that Date.today is picking up today’s date from GMT and not from the local zone.  It requires using Date.current.
Check out this discussion on a rails issue here: https://github.com/rails/rails/issues/759
Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: