Documentation
¶
Overview ¶
Package freelotime defines a time.Time wrapper that handles Freelo's two on-the-wire timestamp formats:
- RFC3339 with timezone, e.g. "2026-04-24T11:12:38+02:00" or "...Z".
- Local-time without timezone, e.g. "2026-04-24T11:12:38". Server-side this represents wall-clock time in Europe/Prague.
The generated client (freeloapi) uses freelotime.Time on every `format: date-time` field so typed *WithResponse methods decode out of the box. Consumers can also construct freelotime.Time values directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidTime = errors.New("freelo: invalid timestamp format")
ErrInvalidTime is returned when UnmarshalJSON receives a string that matches neither RFC3339 nor the local-time layout. Wrapped in the returned error; check via errors.Is.
Functions ¶
This section is empty.
Types ¶
type Time ¶
Time wraps time.Time with JSON (un)marshalling that tolerates Freelo's two timestamp shapes:
RFC3339 with timezone, e.g. "2026-04-24T11:12:38+02:00" or "...Z". Honored as-is; the result is normalized to UTC.
Local-time without timezone, e.g. "2026-04-24T11:12:38". This is what most Freelo endpoints emit today. Interpreted as Europe/Prague wall-clock and converted to UTC.
Marshalling always emits RFC3339 in UTC (e.g. "2026-04-24T09:12:38Z"), which the server accepts on the way back in.
Use freelo.Time anywhere the generated client expects a date-time field; the spec preprocessor in scripts/specgen wires this in by injecting `x-go-type: freelo.Time` on every `format: date-time` schema before oapi-codegen runs.
func (Time) MarshalJSON ¶
MarshalJSON emits the embedded time as RFC3339 in UTC. Zero values marshal to JSON null so the field can be safely omitempty-guarded by the generated client.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON parses a JSON string per the rules documented on Time.