method
iso8601
v6.1.3.1 -
Show latest stable
-
0 notes -
Class: ActiveSupport::TimeZone
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7 (0)
- 5.2.3 (38)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
iso8601(str)
public
Method for creating new ActiveSupport::TimeWithZone instance in time zone of self from an ISO 8601 string.
Time.zone = 'Hawaii' # => "Hawaii" Time.zone.iso8601('1999-12-31T14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
If the time components are missing then they will be set to zero.
Time.zone = 'Hawaii' # => "Hawaii" Time.zone.iso8601('1999-12-31') # => Fri, 31 Dec 1999 00:00:00 HST -10:00
If the string is invalid then an ArgumentError will be raised unlike parse which usually returns nil when given an invalid date string.