Files
pargar/backend/internal/service/util.go
T
ahp 3ee609337c feat(backend): add domain store, learning services, and seed data
Persist LMS entities and implement hearts/watch rules plus curriculum bootstrap.
2026-10-07 19:40:26 +03:30

22 lines
357 B
Go

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)
}