Help us shape the future of Go! Take the 2026 Go Developer Survey

humandate

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package humandate writes a date the way filex's own screens write it, for an app that has no browser to ask.

filex prints every date for a person in ONE format — the explorer's (packages/core useLocale `formatWhen`): "22 Eyl 2026" / "Sep 22, 2026", and with the time "22 Eyl 2026, 15:38" / "Sep 22, 2026, 3:38 PM". A screen the host draws gets it from the browser's Intl. An app writes its own sentences ("the link is valid until …", a mail, a notice), and before this package it wrote them with the ISO day — "2026-09-29" a column away from "22 Eyl 2026" (v0.43.0 wave 2). This is that format, in Go, for every app to share: an app must not grow a copy of its own.

⚠ A server has no reader's clock. A DAY is written as the UTC calendar day it names; a time is UTC, and a sentence that shows one should say "UTC" beside it. Where a value must stay exact and machine-readable (an audit trail, a form field's value), keep ISO 8601 — this is for people.

Languages: en, tr, de, es, fr, matched on the base tag ("de-AT" → de); anything else is English, which is also what a Text falls back to. The strings are CLDR's abbreviated month names and patterns, as a browser's Intl.DateTimeFormat({month: 'short', day: 'numeric', year: 'numeric'}) and ({hour: 'numeric', minute: '2-digit'}) print them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Day

func Day(lang string, t time.Time) string

Day is t's UTC calendar day in lang: "22 Eyl 2026", "Sep 22, 2026", "22. Sept. 2026". "" for the zero time.

func DayTime

func DayTime(lang string, t time.Time) string

DayTime is Day with the UTC time of day: "22 Eyl 2026, 15:38", "Sep 22, 2026, 3:38 PM". Say "UTC" beside it where the hour matters.

func Languages

func Languages() []string

Languages are the tags this package writes in its own words; any other is written in English.

func Stamp

func Stamp(lang, stamp string) string

Stamp reads a stored value — RFC 3339 or a bare YYYY-MM-DD day — and writes its day in lang: the day the stamp itself names, in the offset it was written with (what its first ten characters say), so a stamp for "the 29th, 01:00 +03:00" stays the 29th. A value that is neither comes back as it was ("—", an empty string), so a caller can pass what it has.

Types

This section is empty.

Jump to

Keyboard shortcuts

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