Sha256: 59de80ac7bbd7e799f55abc62e96473729f8285b759bc89348cb260373a49812
Contents?: true
Size: 520 Bytes
Versions: 88
Compression:
Stored size: 520 Bytes
Contents
class NSString # checks ISO8601 formats *before* falling back on natural language detection def nsdate SugarCube::DateParser.iso8601(self) || SugarCube::DateParser.parse_date(self) end def nstimezone case self when /([+-]?\d{4})/ sec = $1[-4,2].to_i * 3600 NSTimeZone.timeZoneForSecondsFromGMT(sec) when /(GMT|UTC)([+-]\d{1,2})?/ sec = $2 ? $2.to_i * 3600 : 0 NSTimeZone.timeZoneForSecondsFromGMT(sec) else NSTimeZone.timeZoneWithName(self) end end end
Version data entries
88 entries across 88 versions & 1 rubygems