class ActiveSupport::TimeZone
def rfc3339(str)
Time.zone = 'Hawaii' # => "Hawaii"
allow for missing components.
be raised. This is much stricter than either +parse+ or +iso8601+ which
If the time or zone components are missing then an +ArgumentError+ will
Time.zone.rfc3339('2000-01-01T00:00:00Z') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
Time.zone = 'Hawaii' # => "Hawaii"
of +self+ from an RFC 3339 string.
\Method for creating new ActiveSupport::TimeWithZone instance in time zone
def rfc3339(str) parts = Date._rfc3339(str) raise ArgumentError, "invalid date" if parts.empty? time = Time.new( parts.fetch(:year), parts.fetch(:mon), parts.fetch(:mday), parts.fetch(:hour), parts.fetch(:min), parts.fetch(:sec) + parts.fetch(:sec_fraction, 0), parts.fetch(:offset) ) TimeWithZone.new(time.utc, self) end