Nimble Industries

Tagrails

Stop using Time.now and Date.today

S

When reviewing Rails apps, I often find many uses of Time.now and Date.today, each of which comes from Ruby itself. Although these methods seem convenient and accessible, they should be avoided inside of Rails apps, as they aren’t converted to the local time zone set inside Rails. Imagine the following (admittedly naive) method inside an Order model: def shipped? shipping_date < Date...

Nimble Industries