makandra / active_type

Make any Ruby object quack like ActiveRecord
MIT License
1.09k stars 74 forks source link

cast failed when database timezone is UTC #92

Closed u1tnk closed 7 years ago

u1tnk commented 7 years ago

database timezone : UTC local timezone: JST

class Foo < ActiveType::Object
  attribute :bar, :datetime
end

foo = Foo.new
foo.bar = "2017-07-20T15:00:00.000+09:00"
p foo.bar # Thu, 20 Jul 2017 06:00:00 JST +09:00 ← failed

active_type: 0.7.0 rails: 5.1.1

u1tnk commented 7 years ago

sorry. I understand that spec failed, but I do not know how to fix it.

kratob commented 7 years ago

Thanks for reporting the issue! I think there is actually another variable here, which might have caused the test failure, and that is your system time zone. I think I've found a fix that works in all cases I could test, so I'm closing this in favor of #94. Will be released as 0.7.2 shortly.

u1tnk commented 7 years ago

it's a great! Thank you! 😄