Date, DateTime and Time, Oh My!
TIL DateTime / Time.now does not respect app time zone settings. TheDateTime / Time.current appears to be the correct (and documented) means of accessing the application’s TZ-adjusted time.
Time.now.zone
#=> "EDT"
Time.current.zone
#=> "UTC"The “equivalent” Date.today is also unpredictable:
Time.now
#=> 2015-06-17 23:17:33 -0400
Time.current
#=> Thu, 18 Jun 2015 03:17:38 UTC +00:00
Time.current.to_date
#=> Thu, 18 Jun 2015
Date.today.send :zone
#=> "+00:00"
Date.today
#=> Wed, 17 Jun 2015This seems to be the TZ respecting way to get just date for today:
Time.current.to_date
#=> Thu, 18 Jun 2015The x.days.from_now etc helpers do appear to respect TZ out of the box.