27.02.26
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from decimal import Decimal, ROUND_HALF_UP
|
||||
|
||||
from datetime import date
|
||||
|
||||
UNITS = (
|
||||
"ZERO ONE TWO THREE FOUR FIVE SIX SEVEN EIGHT NINE TEN ELEVEN TWELVE "
|
||||
@@ -8,6 +8,19 @@ UNITS = (
|
||||
|
||||
TENS = "ZERO TEN TWENTY THIRTY FORTY FIFTY SIXTY SEVENTY EIGHTY NINETY".split()
|
||||
|
||||
def format_date_en(d):
|
||||
if not d:
|
||||
return ''
|
||||
|
||||
day = d.day
|
||||
|
||||
# Gestion des suffixes ordinaux
|
||||
if 10 <= day % 100 <= 20:
|
||||
suffix = 'TH'
|
||||
else:
|
||||
suffix = {1: 'ST', 2: 'ND', 3: 'RD'}.get(day % 10, 'TH')
|
||||
|
||||
return f"{day}{suffix} {d.strftime('%B').upper()} {d.year}"
|
||||
|
||||
def _under_thousand(n):
|
||||
words = []
|
||||
|
||||
Reference in New Issue
Block a user