Skip to content

Commit

Permalink
fix(maintenance): Import time/tzdata to support timezones (#849)
Browse files Browse the repository at this point in the history
Fix #848
  • Loading branch information
TwiN authored Aug 28, 2024
1 parent d04b689 commit 54221ef
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions config/maintenance/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"
"strings"
"time"
_ "time/tzdata" // Required for IANA timezone support
)

var (
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
Expand Down

0 comments on commit 54221ef

Please sign in to comment.