Class: PeanutLabs::Parser::DateOfBirth

Inherits:
Object
  • Object
show all
Defined in:
lib/peanut_labs/parser/date_of_birth.rb

Class Method Summary collapse

Class Method Details

.iframe(value) ⇒ Object

This method formats DateTime, Date, Time to time format required for Iframe (MM-DD-YYYY) It also checks if string is already formatted correctly Can return NIL



11
12
13
# File 'lib/peanut_labs/parser/date_of_birth.rb', line 11

def iframe(value)
  retrieve_date(value, /^\d{2}-\d{2}-\d{4}$/, '%m-%d-%Y')
end

.profile(value) ⇒ Object

This method formats DateTime, Date, Time to time format required for Profile class (YYYY-MM-DD) It also checks if string is already formatted correctly Can return NIL



19
20
21
# File 'lib/peanut_labs/parser/date_of_birth.rb', line 19

def profile(value)
  retrieve_date(value, /^\d{4}-\d{2}-\d{2}$/, '%Y-%m-%d')
end