Add support for New Zealand (en-nz) date/time formats (#5449)

- Implement en-NZ specific formatting in daterange.py
- Create en_NZ/formats.py with NZ-compliant formats
This commit is contained in:
Danny Adair
2025-09-10 01:05:51 +12:00
committed by GitHub
parent 0bb390f0a9
commit cd6fbd886c
3 changed files with 81 additions and 0 deletions

View File

@@ -64,6 +64,16 @@ def daterange(df, dt, as_html=False):
return format_html(base_format, _date(df, "j."), mark_safe(until.strip()), _date(dt, "j. F Y"))
elif df.year == dt.year:
return format_html(base_format, _date(df, "j. F"), until, _date(dt, "j. F Y"))
elif lng == "en-nz":
if df.year == dt.year and df.month == dt.month and df.day == dt.day:
# Mon, 15 January 2024
return format_html(base_format, _date(df, "D, j F Y"))
elif df.year == dt.year and df.month == dt.month:
# 1 3 January 2024
return format_html(base_format, _date(df, "j"), until, _date(dt, "j F Y"))
elif df.year == dt.year:
# 1 January 3 April 2024
return format_html(base_format, _date(df, "j F"), until, _date(dt, "j F Y"))
elif lng.startswith("en"):
if df.year == dt.year and df.month == dt.month and df.day == dt.day:
return format_html(base_format, _date(df, "D, N jS, Y"))