1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
# encoding: utf-8
# frozen_string_literal: true
module Mail
module CommonDate # :nodoc:
# Returns a date time object of the parsed date
def date_time
::DateTime.parse("#{element.date_string} #{element.time_string}")
end
def default
date_time
end
def parse(val = value)
unless Utilities.blank?(val)
@element = Mail::DateTimeElement.new(val)
else
nil
end
end
private
def do_encode(field_name)
"#{field_name}: #{value}\r\n"
end
def do_decode
"#{value}"
end
def element
@element ||= Mail::DateTimeElement.new(value)
end
end
end
|