1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-31 18:31:01 +00:00

fix: json encoding is failing with dates at OAD and negative timezone offset

This commit is contained in:
Frédéric Guillot 2025-01-30 17:28:50 -08:00
parent 7275bc808a
commit c951ac2876
2 changed files with 20 additions and 2 deletions

View file

@ -75,3 +75,17 @@ func TestConvertTimeWithIdenticalTimezone(t *testing.T) {
t.Fatalf(`Unexpected time, got hours=%d, minutes=%d, secs=%d`, hours, minutes, secs)
}
}
func TestConvertPostgresDateTimeWithNegativeTimezoneOffset(t *testing.T) {
tz := "US/Eastern"
input := time.Date(0, 1, 1, 0, 0, 0, 0, time.FixedZone("", -5))
output := Convert(tz, input)
if output.Location().String() != tz {
t.Fatalf(`Unexpected timezone, got %q instead of %s`, output.Location(), tz)
}
if year := output.Year(); year != 0 {
t.Fatalf(`Unexpected year, got %d instead of 0`, year)
}
}