Esc

last_of_year

procedureextensionsince 0.36.1Source
  • macOS: last_of_year works on macOS
  • Linux: last_of_year works on Linux
  • Windows: last_of_year works on Windows
  • Wasm: last_of_year works on Wasm

Returns 31 December of the validated date's year.

Signature

last_of_year :: (value: Date) -> Date

A Date is a whole day, so the end of a period is its last day, inclusive, like last_of_month. For an exclusive bound, add one day. For a Zoned value, pass the local date: to_civil(value.zone, value.timestamp).date.

Example↗
d := last_of_year(Date.{ 2024, 3, 15 });
assert(d.month == 12 && d.day == 31);

See also