timefmt

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const APILayout = "2006-01-02T15:04:05.000-0700"

APILayout is the time format the Cubox API expects.

Variables

This section is empty.

Functions

func Parse

func Parse(input string) (string, error)

Parse converts a human-friendly time string to the Cubox API format. Day-level shortcuts (today, yesterday, 7d, date-only) resolve to the start of the day (00:00:00.000). Use ParseEnd for end-time semantics.

Accepted inputs:

"today"                            → start of today (00:00:00.000)
"yesterday"                        → start of yesterday
"now"                              → current instant
"7d" / "-7d"                       → 7 days ago at 00:00
"2026-04-09"                       → date only, midnight local time
"2026-04-09 17:12"                 → date + hour:minute
"2026-04-09 17:12:48"              → date + time
"2026-04-09T17:12:48"              → ISO-style date + time
"2026-04-09T17:12:48.695+0800"     → full precision
"2026-04-09T17:12:48.695+08:00"    → full precision with colon tz

func ParseEnd added in v1.0.4

func ParseEnd(input string) (string, error)

ParseEnd is like Parse but resolves day-level inputs to end-of-day (23:59:59.999) instead of midnight. Use this for --end-time parameters so that "today" covers the entire day rather than just its first instant.

Types

This section is empty.

Jump to

Keyboard shortcuts

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