class ActiveSupport::TimeZone
def parse(str, now=now())
Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00
TimeZone#now:
If upper components are missing from the string, they are supplied from
Time.zone.parse('1999-12-31 14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
Time.zone = 'Hawaii' # => "Hawaii"
of +self+ from parsed string.
Method for creating new ActiveSupport::TimeWithZone instance in time zone
def parse(str, now=now()) parts = Date._parse(str, false) return if parts.empty? time = Time.new( parts.fetch(:year, now.year), parts.fetch(:mon, now.month), parts.fetch(:mday, now.day), parts.fetch(:hour, 0), parts.fetch(:min, 0), parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0), parts.fetch(:offset, 0) ) if parts[:offset] TimeWithZone.new(time.utc, self) else TimeWithZone.new(nil, self, time) end end