mirror of
https://github.com/LukeHagar/slinky.git
synced 2025-12-06 12:47:45 +00:00
Improve timezone handling in WriteMarkdown function of markdown.go by adding error checking for LoadLocation and providing a fallback to a fixed timezone if loading fails.
This commit is contained in:
@@ -57,7 +57,10 @@ func WriteMarkdown(path string, results []web.Result, s Summary) (string, error)
|
||||
if dur < 0 {
|
||||
dur = 0
|
||||
}
|
||||
loc, _ := time.LoadLocation("America/Chicago")
|
||||
loc, tzErr := time.LoadLocation("America/Chicago")
|
||||
if tzErr != nil || loc == nil {
|
||||
loc = time.FixedZone("CST", -6*60*60)
|
||||
}
|
||||
buf.WriteString(fmt.Sprintf("Last Run: %s (Duration: %s)\n\n", s.StartedAt.In(loc).Format("2006-01-02 15:04:05 MST"), dur.Truncate(time.Millisecond)))
|
||||
|
||||
// Summary list: Pass, Fail, Total
|
||||
|
||||
Reference in New Issue
Block a user