You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to add a way just to check if a given string is a valid date?
validates:release_date,date: true@product.release_date="1/1/ab"@product.should_notbe_validFailure/Error: @product.should_notbe_validexpected#<Product id: nil, name: "Assassin's Creed", properties: {"platform"=>"PS3", "release_date"=>"31/12/ab"}> not to be valid
Yea would like that too. Using that gem in like form-objects where the input is a string, the gem currently wont recognize a correct string representation of a date.
@Skulli in case of usage Reform form objects it's possible to include Coercion module from virtus gem to correctly handle string representation of a date.
Activity
txus commentedon Sep 19, 2013
@abitdodgy this particular case is not handled :) Care to give it a try in a PR?
Skulli commentedon Feb 25, 2016
Yea would like that too. Using that gem in like form-objects where the input is a string, the gem currently wont recognize a correct string representation of a date.
abitdodgy commentedon Feb 25, 2016
@txus Sorry, I missed your comment. I'll give this a bash, more than two years later 😆
drakmail commentedon Jun 7, 2016
@Skulli in case of usage Reform form objects it's possible to include Coercion module from
virtusgem to correctly handle string representation of a date.SirRawlins commentedon Nov 9, 2016
@drakmail's approach appears to work nicely, for more details checkout the Reform docs. http://trailblazer.to/gems/reform/options.html#coercion