This commit is contained in:
20
internal/utils/first_day_of_month.go
Normal file
20
internal/utils/first_day_of_month.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package utils
|
||||
|
||||
import "time"
|
||||
|
||||
func FirstDayOfMonth() string {
|
||||
// Load America/Detroit timezone
|
||||
loc, err := time.LoadLocation("America/Detroit")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Get current time in Detroit timezone
|
||||
now := time.Now().In(loc)
|
||||
|
||||
// Create midnight of the first day of the current month
|
||||
firstDay := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, loc)
|
||||
|
||||
// Return ISO8601 formatted string
|
||||
return firstDay.Format(time.RFC3339)
|
||||
}
|
||||
Reference in New Issue
Block a user