From 9c9436b66f2027688881aa0962c024b7d9a2a4b2 Mon Sep 17 00:00:00 2001 From: Dzung Tran Date: Wed, 11 May 2022 22:15:35 +0700 Subject: [PATCH] update goreport badge --- pkg/utils/times.go | 50 ---------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 pkg/utils/times.go diff --git a/pkg/utils/times.go b/pkg/utils/times.go deleted file mode 100644 index 360febd..0000000 --- a/pkg/utils/times.go +++ /dev/null @@ -1,50 +0,0 @@ -package utils - -import "time" - -func GetFirstDayOfNextMonth(now time.Time) int64 { - var nextMonthFirstDay int64 = 0 - currentYear, currentMonth, _ := now.Date() - location := now.Location() - - if currentMonth < 12 { - nextMonthFirstDay = time.Date(currentYear, currentMonth+1, 1, 0, 0, 1, 0, location).Unix() - } else { - nextMonthFirstDay = time.Date(currentYear+1, 1, 1, 0, 0, 1, 0, location).Unix() - } - - return nextMonthFirstDay -} - -func GetFirstDayOfPreviousMonth(now time.Time) int64 { - var previousMonthFirstDay int64 = 0 - currentYear, currentMonth, _ := now.Date() - location := now.Location() - - if currentMonth == 1 { - previousMonthFirstDay = time.Date(currentYear-1, 12, 1, 0, 0, 1, 0, location).Unix() - } else { - previousMonthFirstDay = time.Date(currentYear, currentMonth-1, 1, 0, 0, 1, 0, location).Unix() - } - - return previousMonthFirstDay -} - -func GetLastDayOfMonth(now time.Time) int64 { - currentYear, currentMonth, _ := now.Date() - currentLocation := now.Location() - - firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation) - lastOfMonth := firstOfMonth.AddDate(0, 1, -1).Unix() - - return lastOfMonth -} - -func GetFirstDayOfMonth(now time.Time) int64 { - currentYear, currentMonth, _ := now.Date() - currentLocation := now.Location() - - firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation).Unix() - - return firstOfMonth -}