Files
Dušan Borovčanin ef5c253c51 SMQ-3399 - Unify Magistrala and SuperMQ (#3400)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: dusan <borovcanindusan1@gmail.com>
Co-authored-by: Steve Munene <stevenyaga2014@gmail.com>
2026-04-01 09:55:11 +02:00

26 lines
543 B
Go

// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
package reports
import (
"strings"
"time"
)
// resolveTimezone returns a *time.Location from a user-provided IANA timezone name.
// Supported inputs:
// - IANA names (e.g., "Europe/Paris", "America/New_York").
// - Empty string defaults to UTC.
func resolveTimezone(s string) (*time.Location, error) {
s = strings.TrimSpace(s)
if s == "" {
return time.UTC, nil
}
loc, err := time.LoadLocation(s)
if err != nil {
return time.UTC, err
}
return loc, nil
}