Class: Achoo::Form

Inherits:
Object
  • Object
show all
Defined in:
lib/achoo/form.rb

Direct Known Subclasses

HourAdministrationForm, HourRegistrationForm

Instance Method Summary collapse

Instance Method Details

#dateObject



14
15
16
17
# File 'lib/achoo/form.rb', line 14

def date
  Date.new(year_field.value.to_i, month_field.value.to_i, 
           day_field.value.to_i)
end

#date=(date) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/achoo/form.rb', line 6

def date=(date)
  # Day and month must be prefixed with '0' if single
  # digit. Date.day and Date.month doesn't do this. Use strftime
  day_field.value   = date.strftime('%d')
  month_field.value = date.strftime('%m')
  year_field.value  = date.year
end