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

tod support #162

Open jaysson opened 6 years ago

jaysson commented 6 years ago

When I serialize the time field using https://github.com/jackc/tod, I get "not a valid time" error from validates_timeliness.

# my_model.rb
class MyModel  < ApplicationRecord
  validates_time :closes_at, after: :opens_at
  serialize :opens_at, Tod::TimeOfDay
  serialize :closes_at, Tod::TimeOfDay
end
MyModel.where(opens_at: "10:30", closes_at: "14:30").first_or_create
# Closes at is not a valid time