mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Fix ordinal filter in template (#18878)
This commit is contained in:
parent
c69fe43e75
commit
558504c686
@ -616,8 +616,9 @@ def base64_decode(value):
|
||||
def ordinal(value):
|
||||
"""Perform ordinal conversion."""
|
||||
return str(value) + (list(['th', 'st', 'nd', 'rd'] + ['th'] * 6)
|
||||
[(int(str(value)[-1])) % 10] if not
|
||||
int(str(value)[-2:]) % 100 in range(11, 14) else 'th')
|
||||
[(int(str(value)[-1])) % 10] if
|
||||
int(str(value)[-2:]) % 100 not in range(11, 14)
|
||||
else 'th')
|
||||
|
||||
|
||||
@contextfilter
|
||||
|
Loading…
x
Reference in New Issue
Block a user