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
Date.today == Date.yesterday

Interestings

Date.today == Date.yesterday

Date.today uses your current time zone, while Date.yesterday defaults to UTC. Why the difference? Date.today is a built in Ruby method, while Date.yesterday and Date.tomorrow are Rails helpers. The Rails team doesn't like redefining methods built in to Ruby, so they introduced Date.current to be used with Date.yesterday and Date.tomorrow. The upshot is, late in the afternoon in SF, Date.today will be equal to Date.yesterday, which may lead to unexpected behavior or failing tests.

Comments
Post a Comment

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

* Copy This Password *

* Type Or Paste Password Here *