timeutil

package
v3.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatLocal

func FormatLocal(utc string) string

FormatLocal converts a UTC timestamp string to the configured display timezone using the default layout ("2006-01-02 15:04:05"). When ENGRAM_TIMEZONE is unset or invalid it falls back to system local time. Unparseable input is returned as-is.

Accepted input layouts: "2006-01-02 15:04:05" (SQLite style), time.RFC3339, time.RFC3339Nano.

func FormatLocalWithLayout

func FormatLocalWithLayout(utc, layout string) string

FormatLocalWithLayout is the layout-aware variant of FormatLocal. It applies the same timezone conversion rules and accepts the same input formats, but renders the output with the caller's layout. Use this when a UI surface (e.g. the dashboard) needs a specific display style while still honoring ENGRAM_TIMEZONE.

If the input cannot be parsed in any of the accepted layouts, the original string is returned unchanged so callers never lose data on malformed timestamps.

func FormatTimeWithLayout

func FormatTimeWithLayout(t time.Time, layout string) string

FormatTimeWithLayout renders a typed instant in the configured display timezone. Unset or invalid ENGRAM_TIMEZONE falls back to system local time.

Types

This section is empty.

Jump to

Keyboard shortcuts

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