From b1c55eb1b169dc2497f091339bc9ac6d78d05a95 Mon Sep 17 00:00:00 2001 From: max/sooulix Date: Thu, 15 Aug 2024 06:20:40 +0200 Subject: [PATCH] [utils] add a format_date_year function --- jsonresume_reader.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jsonresume_reader.py b/jsonresume_reader.py index c520cb8..f4b51e5 100644 --- a/jsonresume_reader.py +++ b/jsonresume_reader.py @@ -46,12 +46,18 @@ class JSONResumeReader(readers.RstReader): def format_date_short(d): return date.fromisoformat(d).strftime('%B %Y').capitalize() + @setlocale + def format_date_year(d): + return date.fromisoformat(d).strftime('%Y').capitalize() + + format_date_full = lambda d: date.fromisoformat(d).strftime('%d %B %Y').capitalize() isinfinite = lambda d: date.fromisoformat(d).isoformat() == '2999-01-01' metadata['utils'] = { 'get_country_name': countryname, 'format_date_short': format_date_short, 'format_date_full': format_date_full, + 'format_date_year': format_date_year, 'isinfinite': isinfinite } return content, metadata