time

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package time defines date and time format layouts and duration constants.

Index

Constants

View Source
const (
	// DateFormat is the canonical YYYY-MM-DD date layout for time.Parse.
	DateFormat = "2006-01-02"
	// DateTimeFormat is DateFormat with hours and minutes (HH:MM).
	DateTimeFormat = "2006-01-02 15:04"
	// DateTimePreciseFormat is DateFormat with hours, minutes, and seconds.
	DateTimePreciseFormat = "2006-01-02 15:04:05"
	// Format is the hours:minutes:seconds layout for timestamps.
	Format = "15:04:05"
	// TimestampCompact is the YYYYMMDD-HHMMSS layout used in entry headers
	// and task timestamps (e.g., 2026-01-28-143022).
	TimestampCompact = "2006-01-02-150405"
)

Date and time format constants.

View Source
const (
	// DateHyphenPos1 is the index of the first hyphen (after YYYY).
	DateHyphenPos1 = 4
	// DateHyphenPos2 is the index of the second hyphen (after MM).
	DateHyphenPos2 = 7
)

Byte positions of hyphens in a YYYY-MM-DD date string.

View Source
const DateMinLen = len(DateFormat)

DateMinLen is the minimum string length for a YYYY-MM-DD date (10 characters).

View Source
const (
	// HoursPerDay is the number of hours in a day for duration calculations.
	HoursPerDay = 24
)
View Source
const InclusiveUntilOffset = 24*time.Hour - time.Second

InclusiveUntilOffset is the duration added to an --until date to make it inclusive of the entire day (23:59:59).

View Source
const OlderFormat = "Jan 2, 2006"

OlderFormat is the Go time layout for dates older than a week. Exported because callers must format the fallback date before calling FormatTimeAgo.

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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