adzap / validates_timeliness

Date and time validation plugin for ActiveModel and Rails. Supports multiple ORMs and allows custom date/time formats.
MIT License
1.59k stars 227 forks source link

Take into consideration active record time zone aware flag #202

Closed camilova closed 2 years ago

camilova commented 3 years ago

When active record has the flag config.active_record.time_zone_aware_attributes setted to false time zone aware should not used, and same case when attribute class is not included on classes with time zone aware defined by AR too.

adzap commented 2 years ago

Thanks for this. This PR confused me at first but it demonstrates a few issues that exist in the gem which need fixing.

Which are:

  1. That AR is expected in the validator class despite this gem offering ActiveModel support rather than AR specifically
  2. That the gem implicitly expects a timezone aware attributes, which is not intended
  3. The gem doesn't check time_zone_aware_types at all which is problematic if you want to control that

But your implementation is not quite what I'd like, so I'm going to review whether some of this AR specific code can be moved to an ORM extension.

camilova commented 2 years ago

Thank you @adzap, I will close this in favor of an ORM extension that I think is a better approach than this.