Method: Time.rfc3339
- Defined in:
- activesupport/lib/active_support/core_ext/time/calculations.rb
.rfc3339(str) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'activesupport/lib/active_support/core_ext/time/calculations.rb', line 69 def rfc3339(str) parts = Date._rfc3339(str) raise ArgumentError, "invalid date" if parts.empty? 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) ) end |