From 558504c686e755183dc868db84e366272b15f063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sat, 1 Dec 2018 14:49:34 +0100 Subject: [PATCH] Fix ordinal filter in template (#18878) --- homeassistant/helpers/template.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index 6d6fb1ed200..99eb0a9c034 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -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