yearEnd
yearEnd, function
def const pure yearEnd(d: date): date
def const pure yearEnd(m: month): date
Returns the last day of the Gregorian year for a date or month.
Example (date input)
table D = with
[| as Label, as D |]
[| "2020-01-01", date(2020, 1, 1) |]
[| "2019-05-01", date(2019, 5, 1) |]
show table "Year end (date)" with
D.Label
yearEnd(D.D) as "YearEnd"
This outputs the following table:
| Label | YearEnd |
|---|---|
| 2020-01-01 | 2020-12-31 |
| 2019-05-01 | 2019-12-31 |
Example (month input)
table M = with
[| as Label, as M |]
[| "2022-01", month(2022, 1) |]
[| "2022-12", month(2022, 12) |]
show table "Year end (month)" with
M.Label
yearEnd(M.M) as "YearEnd"
This outputs the following table:
| Label | YearEnd |
|---|---|
| 2022-01 | 2022-12-31 |
| 2022-12 | 2022-12-31 |