Respect time zones: Use Time.current and Time.zone.parse

Reading the current time

Don't use Time.now as it's broken when using time zones. \
Instead, use Time.current, DateTime.current or Date.current (the latter actually not being different, but just use it for good measure).

Parsing strings

Don't use Time.parse as it only gives you a Time object.
Use Time.zone.parse instead for a TimeWithZone.

Arne Hartherz over 9 years ago
This website uses short-lived cookies to improve usability.
Accept or learn more