Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/lucid_works/patch_time.rb
Overview
:nodoc:
Class Method Summary collapse
-
.iso8601_with_support_for_timezones_without_colons(datetime_string) ⇒ Object
Ruby’s ‘Time.is08601 can’t handle timezone offsets expressed as +nnnn.
Instance Method Summary collapse
Class Method Details
.iso8601_with_support_for_timezones_without_colons(datetime_string) ⇒ Object
Ruby’s ‘Time.is08601 can’t handle timezone offsets expressed as nnnn. It prefers nn:nn. Morph the former to the latter.
7 8 9 |
# File 'lib/lucid_works/patch_time.rb', line 7 def iso8601_with_support_for_timezones_without_colons(datetime_string) iso8601_without_support_for_timezones_without_colons(datetime_string.gsub /([+-])(\d\d)(\d\d)$/, '\1\2:\3') end |
Instance Method Details
#iso8601_with_support_for_timezones_without_colons ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/lucid_works/patch_time.rb', line 14 def iso8601_with_support_for_timezones_without_colons unfixed_string = self.iso8601_without_support_for_timezones_without_colons if unfixed_string =~ /Z$/ unfixed_string.gsub /Z$/, '+0000' else unfixed_string.gsub /([+-])(\d\d):(\d\d)$/, '\1\2\3' end end |