Documentation
¶
Index ¶
- func Add(d time.Duration) func(destination ro.Observable[time.Time]) ro.Observable[time.Time]
- func AddDate(years int, months int, days int) func(destination ro.Observable[time.Time]) ro.Observable[time.Time]
- func Format(format string) func(destination ro.Observable[time.Time]) ro.Observable[string]
- func In(loc *time.Location) func(destination ro.Observable[time.Time]) ro.Observable[time.Time]
- func Parse[T ~string](layout string) func(ro.Observable[T]) ro.Observable[time.Time]
- func ParseInLocation[T ~string](layout string, loc *time.Location) func(ro.Observable[T]) ro.Observable[time.Time]
- func StartOfDay() func(ro.Observable[time.Time]) ro.Observable[time.Time]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
func Add(d time.Duration) func(destination ro.Observable[time.Time]) ro.Observable[time.Time]
Add returns an operator that adds a fixed duration to each time value.
Example:
obs := ro.Pipe1(
ro.Just(time.Now()),
rotime.Add(2*time.Hour),
)
The observable then emits: time.Now().Add(2 * time.Hour).
func AddDate ¶
func AddDate(years int, months int, days int) func(destination ro.Observable[time.Time]) ro.Observable[time.Time]
AddDate returns an operator that adds a date offset (years, months, days) to each time value.
Example:
obs := ro.Pipe1(
ro.Just(time.Date(2026, time.January, 7, 14, 30, 0, 0, time.UTC)),
rotime.AddDate(0, 1, 0),
)
The observable then emits: time.Date(2026, time.February, 7, 14, 30, 0, 0, time.UTC).
func Format ¶
func Format(format string) func(destination ro.Observable[time.Time]) ro.Observable[string]
Format returns an operator that formats each time value using the given layout.
Example:
obs := ro.Pipe1(
ro.Just(time.Date(2026, time.January, 7, 14, 30, 0, 0, time.UTC)),
rotime.Format("2006-01-02 15:04:05"),
)
The observable then emits: "2026-01-07 14:30:00".
func In ¶
func In(loc *time.Location) func(destination ro.Observable[time.Time]) ro.Observable[time.Time]
In returns an operator that converts each time value to the given location.
Example:
loc, _ := time.LoadLocation("Europe/Paris")
obs := ro.Pipe1(
ro.Just(time.Date(2026, time.January, 7, 14, 30, 0, 0, time.UTC)),
rotime.In(loc),
)
The observable then emits: time.Date(2026, time.January, 7, 15, 30, 0, 0, loc).
func Parse ¶
func Parse[T ~string](layout string) func(ro.Observable[T]) ro.Observable[time.Time]
Parse returns an operator that parses time strings using the given layout.
Example:
obs := ro.Pipe[string, time.Time](
ro.Just("2026-01-07 14:30:00"),
rotime.Parse("2006-01-02 15:04:05"),
)
The observable then emits: time.Date(2026, time.January, 7, 14, 30, 0, 0, time.UTC).
func ParseInLocation ¶
func ParseInLocation[T ~string](layout string, loc *time.Location) func(ro.Observable[T]) ro.Observable[time.Time]
ParseInLocation returns an operator that parses time strings in the given location.
Example:
obs := ro.Pipe[string, time.Time](
ro.Just("2026-01-07 14:30:00"),
rotime.ParseInLocation("2006-01-02 15:04:05", time.UTC),
)
The observable then emits: time.Date(2026, time.January, 7, 14, 30, 0, 0, time.UTC).
func StartOfDay ¶
func StartOfDay() func(ro.Observable[time.Time]) ro.Observable[time.Time]
StartOfDay returns an operator that truncates each time value to the start of its day.
Example:
obs := ro.Pipe1(
ro.Just(time.Date(2026, time.January, 7, 14, 30, 0, 0, time.UTC)),
rotime.StartOfDay(),
)
The observable then emits: time.Date(2026, time.January, 7, 0, 0, 0, 0, time.UTC).
Types ¶
This section is empty.