func TestMinutesInTimeZone(t *testing.T) { time, err := Parse(RubyDate, "Mon Jan 02 15:04:05 +0123 2006") if err != nil { t.Fatal("error parsing date:", err) } expected := (1*60 + 23) * 60 _, offset := time.Zone() if offset != expected { t.Errorf("ZoneOffset = %d, want %d", offset, expected) } }
func TestParseSecondsInTimeZone(t *testing.T) { // should accept timezone offsets with seconds like: Zone America/New_York -4:56:02 - LMT 1883 Nov 18 12:03:58 for _, test := range secondsTimeZoneOffsetTests { time, err := Parse(test.format, test.value) if err != nil { t.Fatal("error parsing date:", err) } _, offset := time.Zone() if offset != test.expectedoffset { t.Errorf("ZoneOffset = %d, want %d", offset, test.expectedoffset) } } }