photoprism/pkg/time/tz/local.go
Michael Mayer 5cd2c25489 Metadata: Move timezone related functions to /pkg/time/tz #4622 #4946
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-04-23 12:50:12 +02:00

26 lines
465 B
Go

package tz
import (
"strings"
"time"
)
// IsLocal returns true if the time zone string represents Local time.
func IsLocal(s string) bool {
if s == Unknown {
return true
} else if len(s) != len(Local) {
return false
}
return strings.EqualFold(s, Local)
}
// TruncateLocal changes the precision of Local Time to full seconds to avoid jitter.
func TruncateLocal(t time.Time) time.Time {
if t.IsZero() {
return t
}
return t.Truncate(time.Second)
}