Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

PIVOTAL LABS
UTC FTW

Interestings

Date.yesterday is a lie

Rails provides a handy 'Date.yesterday' method. This effectively uses 'Time.zone.today' to calculate yesterday as per the configured timezone.

Ruby's 'Date.today' method uses the system's timezone via a call to localtime(). Therefore, if your Rails app is configured in UTC and you live on the West Coast, tests that assert that 'yesterday < today' will start failing at around 5pm.

Comments
Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *