lib/timing/time_in_zone.rb in timing-0.0.5 vs lib/timing/time_in_zone.rb in timing-0.0.6
- old
+ new
@@ -56,10 +56,15 @@
strftime '%F %T %z'
end
alias_method :inspect, :to_s
def strftime(format)
- time_with_offset.strftime format.gsub('%Z', '').gsub('%z', zone_offset.to_s)
+ sanitized_format = format.gsub('%Z', '')
+ .gsub('%z', zone_offset.to_s)
+ .gsub('%:z', zone_offset.to_s(':'))
+ .gsub('%::z', "#{zone_offset.to_s(':')}:00")
+
+ time_with_offset.strftime sanitized_format
end
def iso8601
strftime "%FT%T#{zone_offset.iso8601}"
end
\ No newline at end of file