class Hoodoo::Presenters::DateTime
A JSON DateTime
schema member.
Public Instance Methods
validate( data, path = '' )
click to toggle source
Check if data is a valid DateTime
and return a Hoodoo::Errors
instance.
Calls superclass method
Hoodoo::Presenters::Field#validate
# File lib/hoodoo/presenters/types/date_time.rb, line 10 def validate( data, path = '' ) errors = super( data, path ) return errors if errors.has_errors? || ( ! @required && data.nil? ) unless Hoodoo::Utilities.valid_iso8601_subset_datetime?( data ) errors.add_error( 'generic.invalid_datetime', :message => "Field `#{ full_path( path ) }` is an invalid ISO8601 datetime", :reference => { :field_name => full_path( path ) } ) end errors end