timeutil

package
v0.0.0-...-c0601ea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package timeutil provides standardized UTC time helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateNextWindow

func CalculateNextWindow(t time.Time, loc *time.Location) time.Time

CalculateNextWindow calculates the next valid slot (07:30 AM next weekday morning, or weekend).

func FormatISO

func FormatISO(t time.Time) string

FormatISO formats a timestamp to RFC3339 in UTC.

func FormatUTCISO

func FormatUTCISO(t time.Time) string

FormatUTCISO formats a timestamp to RFC3339 in UTC.

func IsCommitWindowAllowed

func IsCommitWindowAllowed(t time.Time, loc *time.Location) bool

IsCommitWindowAllowed returns true if weekend, or if weekday and hour < 8.

func IsMorningAllowed

func IsMorningAllowed(t time.Time, cutoffHour int) bool

IsMorningAllowed reports whether the time's hour is before cutoffHour.

func IsWeekday

func IsWeekday(t time.Time) bool

IsWeekday reports whether the given time falls on Monday through Friday.

func IsWeekend

func IsWeekend(t time.Time) bool

IsWeekend reports whether the given time falls on Saturday or Sunday.

func NowUTC

func NowUTC() time.Time

NowUTC returns the current UTC time.

func NowUTCISO

func NowUTCISO() string

NowUTCISO returns the current UTC timestamp formatted as RFC3339.

func ParseISO

func ParseISO(s string) (time.Time, error)

ParseISO parses an RFC3339 timestamp string into time.Time.

func ResolveLocation

func ResolveLocation(raw string) (*time.Location, error)

ResolveLocation resolves IANA names, "UTC", "Local", and numeric offsets (+08:00, -0400).

func SimulateMorningWindow

func SimulateMorningWindow(t time.Time, loc *time.Location) time.Time

SimulateMorningWindow returns a compliant 07:30 AM timestamp for the day in loc.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL