From ade49589a921c56f37d008a2798767a0f44e4611 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sun, 3 Oct 2021 18:35:04 +0200 Subject: [PATCH] add another test and fix local. --- models/timeofday.go | 2 +- models/timeofday_test.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/models/timeofday.go b/models/timeofday.go index 58b26fd..1c5f1b2 100644 --- a/models/timeofday.go +++ b/models/timeofday.go @@ -82,7 +82,7 @@ func (t TimeOfDay) IsBetween(from TimeOfDay, to TimeOfDay) bool { } func CurrentTimeOfDay() TimeOfDay { - return TimeOfDayFromDate(time.Now()) + return TimeOfDayFromDate(time.Now().Local()) } func TimeOfDayFromDate(date time.Time) TimeOfDay { diff --git a/models/timeofday_test.go b/models/timeofday_test.go index db0b644..d341b1a 100644 --- a/models/timeofday_test.go +++ b/models/timeofday_test.go @@ -27,6 +27,8 @@ func TestTimeOfDay_IsBetween(t *testing.T) { { tod("04:13:57"), tod("21:30"), tod("07"), true }, { tod("16:14:43"), tod("15:30"), tod("16:00"), false }, { tod("16:14:43"), tod("15:30"), tod("16:15"), true }, + { tod("08:45:43"), tod("07:00:00"), tod("21:30:00"), true }, + { tod("07:00:00"), tod("07:00:00"), tod("21:30:00"), true }, } for i, row := range table {