Module: Mail::CommonDate

Included in:
DateField, ResentDateField
Defined in:
lib/mail/fields/common/common_date.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#date_timeObject

Returns a date time object of the parsed date



5
6
7
# File 'lib/mail/fields/common/common_date.rb', line 5

def date_time
  ::DateTime.parse("#{element.date_string} #{element.time_string}")
end

#defaultObject



9
10
11
# File 'lib/mail/fields/common/common_date.rb', line 9

def default
  date_time
end

#parse(val = value) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/mail/fields/common/common_date.rb', line 13

def parse(val = value)
  unless val.blank?
    @element = Mail::DateTimeElement.new(val)
    @tree = @element.tree
  else
    nil
  end
end