EnglishGregorian

EnglishGregorian :: # (opaque)

Small English Gregorian display profile, english-gregorian-short-v1. Dates use an unpadded day and English three-letter month: 7 Sep 2026. Years use astronomical numbering (0000 is 1 BCE), with the same sign and padding as GregorianDate.to_text across its full supported year range. This display text is not a persistence format or a parseable-text contract.

The caller selects clock precision. Minute and Second reject any nonzero omitted fields; Exact includes seconds and the shortest exact fraction. No rounding or truncation occurs. Clock labels do not retain supplied-field resolution, so Exact preserves the value rather than its original spelling. Description types remain separate from these full-date and boundary labels.

Local labels need no zone to display. Display does not prove a label exists in a zone or select an occurrence. Project resolved values using an explicitly chosen context first. Non-Gregorian local values return UnsupportedCalendar; explicit calendar conversion is a separate operation.

Work and output are bounded by the scalar fields: at most 18 ASCII bytes for a date, 15 for a clock, and 35 for a local date/time. No provider lookup, recurrence, ambient locale or clock access occurs. These bounds do not claim an allocation count or native layout.

import time.EnglishGregorian
import time.GregorianDate
import time.LocalDateTime

expect {
    due = GregorianDate.parse("2026-09-07")?
    appointment = LocalDateTime.parse_gregorian("2026-09-07T09:30")?
    EnglishGregorian.date(due) == "7 Sep 2026" and
        EnglishGregorian.local_datetime(appointment, Minute) == Ok("7 Sep 2026, 09:30")
}

Examples assume a package dependency named time.

profile : Str

Identifier of this fixed English Gregorian display convention.

date : GregorianDate -> Str

Display a Gregorian date using an unpadded day and abbreviated English month, with astronomical year numbering across the supported signed year range.

clock : ClockTime, Precision -> Try(Str, PrecisionError)

Display a clock label at the requested precision. Return PrecisionLoss when Minute or Second would omit nonzero fields; never round or truncate.

local_datetime : LocalDateTime, Precision -> Try(Str, Error)

Calendar access is checked before clock precision. The source label is never converted, resolved or rounded as part of presentation.

Precision : [Minute, Second, Exact]

Minute displays hours/minutes, Second includes seconds, and Exact includes the shortest exact fractional seconds. Coarser choices reject lost precision.

PrecisionError : [PrecisionLoss(Precision)]

The requested clock precision would omit a nonzero field.

Error : [UnsupportedCalendar(Calendar), PrecisionLoss(Precision)]

The local label uses an unsupported calendar or would lose clock precision.