Commit Graph

3 Commits

Author SHA1 Message Date
Philip Withnall
9eda0b2fcd gdatetime: Fix typo in comment
This was pointed out in the review for !3696 but owing to a mistake by
me, the fix was not included in the version of the MR which was merged.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3119
2023-11-28 23:14:40 +00:00
Philip Withnall
c8e3302007 gdatetime: Fix copyright/author information on recent GDateTime changes
I wrote the changes before clarifying the copyright status of my
contract with the GNOME Foundation, and forgot to update them.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3119
2023-11-28 23:13:27 +00:00
Philip Withnall
df4aea7620 gdatetime: Add support for %E modifier to g_date_time_format()
The `%E` modifier causes dates to be formatted using an alternative era
representation for years. This doesn’t do anything for most dates, but
in locales such as Thai and Japanese it causes years to be printed using
era names.

In Thai, this means the Thai solar calendar
(https://en.wikipedia.org/wiki/Thai_solar_calendar). In Japanese, this
means Japanese era names
(https://en.wikipedia.org/wiki/Japanese_era_name).

The `%E` modifier syntax follows what’s supported in glibc — see
nl_langinfo(3).

Supporting this is quite involved, as it means loading the `ERA`
description from libc and parsing it.

Unit tests are included.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Fixes: #3119
2023-11-28 19:32:02 +00:00