Files
pargar/backend/internal/service/util.go
T

22 lines
357 B
Go
Raw Normal View History

package service
import (
"encoding/json"
"fmt"
"time"
)
func mustJSON(v any) json.RawMessage {
b, err := json.Marshal(v)
if err != nil {
return json.RawMessage(`{}`)
}
return b
}
// ISOWeek returns the ISO-8601 week key like "2026-W37".
func ISOWeek(t time.Time) string {
year, week := t.ISOWeek()
return fmt.Sprintf("%d-W%02d", year, week)
}