From 54221eff9b75aa8764db676291ef0e44b6337c1e Mon Sep 17 00:00:00 2001 From: TwiN Date: Wed, 28 Aug 2024 18:41:21 -0400 Subject: [PATCH] fix(maintenance): Import time/tzdata to support timezones (#849) Fix #848 --- config/maintenance/maintenance.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/maintenance/maintenance.go b/config/maintenance/maintenance.go index 291f0d11..967443db 100644 --- a/config/maintenance/maintenance.go +++ b/config/maintenance/maintenance.go @@ -6,6 +6,7 @@ import ( "strconv" "strings" "time" + _ "time/tzdata" // Required for IANA timezone support ) var ( @@ -52,7 +53,7 @@ func GetDefaultConfig() *Config { } // IsEnabled returns whether maintenance is enabled or not -func (c Config) IsEnabled() bool { +func (c *Config) IsEnabled() bool { if c.Enabled == nil { return true } @@ -101,7 +102,7 @@ func (c *Config) ValidateAndSetDefaults() error { } // IsUnderMaintenance checks whether the endpoints that Gatus monitors are within the configured maintenance window -func (c Config) IsUnderMaintenance() bool { +func (c *Config) IsUnderMaintenance() bool { if !c.IsEnabled() { return false } @@ -127,7 +128,7 @@ func (c Config) IsUnderMaintenance() bool { return now.After(startOfMaintenancePeriod) && now.Before(endOfMaintenancePeriod) } -func (c Config) hasDay(day string) bool { +func (c *Config) hasDay(day string) bool { for _, d := range c.Every { if d == day { return true