I've noticed a time zone bug in the following code...


That's creating a new time with either :utc or :local.  The issue is when
using :local, that creates a new time based on the systems local time zone,
and ignores the time set in the app via config.time_zone = 'Central Time
(US & Canada)'

So if the app is set for CST (via config.time_zone), but the local system
time zone in EST, the time will be created for EST even if the app is set
for CST.

So in code such as

class FormObject
  include ActiveModel::Model
  include ActiveModel::Attributes
  include ActiveRecord::AttributeAssignment
  attribute :received_at, :datetimeend

obj = FormObject.new received_at: '2020-01-02 00:50'
obj.received_at # 2020-01-02 00:50:00 -0500 => should be 2020-01-02
00:50:00 -0600

The resulting time is wrong because the time zone set in the app is being

Any reason this would be occurring the way it is or is it a bug?


You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to