Effect's DateTime.format, formatLocal, formatUtc: what
Intl.DateTimeFormat prints under Node::
intl.format_utc(dt, locale="en-GB", date_style="full")
intl.format_utc(dt, year="numeric", month="long", day="numeric")No option is 3/15/2024, as Intl.DateTimeFormat's default; no
locale is the environment's, as Node's default (LC_ALL,
LC_MESSAGES, LANG; en-US when unset). time_zone names the zone
(the datetime's own for format, the system's for format_local;
format_utc is always UTC, as Effect's). V8's option handling and ICU's
formatting are ported, reading the data ICU 78.3 ships (CLDR 48, as Node
24.22.1 has it), so the text is that Node's.
A -u-ca- calendar other than gregory, buddhist and persian is a
ValueError.
Classes#
Functions#
format_utc#
format_utc(dt, **options) -> strdt in UTC, for the locale (Effect's formatUtc, which puts UTC
over a time_zone).
| Parameter | Type | Description |
|---|---|---|
dt | datetime | |
options | Unpack[FormatOptions] = {} |
Returns str
def format_utc(dt: datetime, **options: Unpack[FormatOptions]) -> str:
"""``dt`` in UTC, for the locale (Effect's ``formatUtc``, which puts UTC
over a ``time_zone``)."""
return _in(dt, UTC, options)format_local#
format_local(dt, **options) -> strdt in the system's zone (or time_zone) (Effect's formatLocal).
| Parameter | Type | Description |
|---|---|---|
dt | datetime | |
options | Unpack[FormatOptions] = {} |
Returns str
def format_local(dt: datetime, **options: Unpack[FormatOptions]) -> str:
"""``dt`` in the system's zone (or ``time_zone``) (Effect's ``formatLocal``)."""
return _in(dt, _zone(options, zone_local()), options)format#
format(dt, **options) -> strdt in its own zone (or time_zone) (Effect's format).
| Parameter | Type | Description |
|---|---|---|
dt | datetime | |
options | Unpack[FormatOptions] = {} |
Returns str
def format(dt: datetime, **options: Unpack[FormatOptions]) -> str:
"""``dt`` in its own zone (or ``time_zone``) (Effect's ``format``)."""
own = dt.tzinfo
return _in(dt, _zone(options, UTC if own is None else own), options)