[utils] add a format_date_year function

This commit is contained in:
max/sooulix 2024-08-15 06:20:40 +02:00
parent d29d569578
commit b1c55eb1b1
1 changed files with 6 additions and 0 deletions

View File

@ -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