From 4ae2b36b4bc67fdfede55cfdbe67f6a32db454e1 Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Tue, 4 Jun 2024 00:30:55 +0700 Subject: [PATCH] schedule-history: fix time zone issue in schedule history list by day --- api/schedule_history_list_by_day.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/schedule_history_list_by_day.go b/api/schedule_history_list_by_day.go index b4c3a1c..492cc84 100644 --- a/api/schedule_history_list_by_day.go +++ b/api/schedule_history_list_by_day.go @@ -29,8 +29,8 @@ func (params *ScheduleHistoryListByDateParams) FillFromQuery(query Queryable) { } func (params *ScheduleHistoryListByDateParams) CountQuery() (expr []bob.Mod[*dialect.SelectQuery]) { - unixTopTime := time.Date(params.Date.Year(), params.Date.Month(), params.Date.Day(), 23, 59, 59, 0, params.Date.Location()).Unix() - unixLowTime := time.Date(params.Date.Year(), params.Date.Month(), params.Date.Day(), 0, 0, 0, 0, params.Date.Location()).Unix() + unixTopTime := time.Date(params.Date.Year(), params.Date.Month(), params.Date.Day(), 23, 59, 59, 0, time.UTC).Unix() + unixLowTime := time.Date(params.Date.Year(), params.Date.Month(), params.Date.Day(), 0, 0, 0, 0, time.UTC).Unix() expr = append(expr, models.SelectWhere.ScheduleHistories.CreatedAt.GTE(unixLowTime), models.SelectWhere.ScheduleHistories.CreatedAt.LTE(unixTopTime),