-
- {% block success-message %}
- {% endblock success-message %}
-
+ {# djlint:off #}
+ {% if enrollment.supports_expiration %}
+
{% translate "Your benefit will expire on" %} {{ enrollment.expires|date }}.
+
+ {% else %}
+
+ {% endif %}
+ {% block success-message %}
+ {% endblock success-message %}
+
+ {# djlint:on #}
{% translate "Thank you for using Cal-ITP Benefits!" %}
diff --git a/benefits/locale/__init__.py b/benefits/locale/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/benefits/locale/en/LC_MESSAGES/django.po b/benefits/locale/en/LC_MESSAGES/django.po
index 4855c4e2e..b64c217d4 100644
--- a/benefits/locale/en/LC_MESSAGES/django.po
+++ b/benefits/locale/en/LC_MESSAGES/django.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n"
-"POT-Creation-Date: 2024-04-25 14:33-0700\n"
+"POT-Creation-Date: 2024-04-26 16:57+0000\n"
"Language: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -637,6 +637,9 @@ msgstr ""
msgid "Success! Your transit benefit is now connected to your card."
msgstr ""
+msgid "Your benefit will expire on"
+msgstr ""
+
msgid "Thank you for using Cal-ITP Benefits!"
msgstr ""
diff --git a/benefits/locale/en/__init__.py b/benefits/locale/en/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/benefits/locale/en/formats.py b/benefits/locale/en/formats.py
new file mode 100644
index 000000000..fbe2609bc
--- /dev/null
+++ b/benefits/locale/en/formats.py
@@ -0,0 +1,2 @@
+# https://docs.djangoproject.com/en/5.0/ref/templates/builtins/#date-and-time-formatting-specifiers
+DATE_FORMAT = "F j, Y"
diff --git a/benefits/locale/es/LC_MESSAGES/django.po b/benefits/locale/es/LC_MESSAGES/django.po
index c7841b5bd..71ace160e 100644
--- a/benefits/locale/es/LC_MESSAGES/django.po
+++ b/benefits/locale/es/LC_MESSAGES/django.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n"
-"POT-Creation-Date: 2024-04-25 14:33-0700\n"
+"POT-Creation-Date: 2024-04-26 16:57+0000\n"
"Language: Español\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -763,6 +763,9 @@ msgstr "Éxito"
msgid "Success! Your transit benefit is now connected to your card."
msgstr "¡Éxito! Su beneficio de tránsito ahora está conectado a su tarjeta."
+msgid "Your benefit will expire on"
+msgstr ""
+
msgid "Thank you for using Cal-ITP Benefits!"
msgstr "¡Gracias por usar Cal-ITP Benefits!"
diff --git a/benefits/locale/es/__init__.py b/benefits/locale/es/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/benefits/locale/es/formats.py b/benefits/locale/es/formats.py
new file mode 100644
index 000000000..86e0c3fdb
--- /dev/null
+++ b/benefits/locale/es/formats.py
@@ -0,0 +1,5 @@
+# Both “d” and “e” are backslash-escaped, because otherwise each is a format string
+# that displays the day and the timezone name, respectively.
+# Instead we want the literal word "de"
+# https://docs.djangoproject.com/en/5.0/ref/templates/builtins/#date-and-time-formatting-specifiers
+DATE_FORMAT = r"j \d\e F \d\e Y"
diff --git a/benefits/settings.py b/benefits/settings.py
index c1ad706c0..2d72dc8d2 100644
--- a/benefits/settings.py
+++ b/benefits/settings.py
@@ -207,6 +207,11 @@ def RUNTIME_ENVIRONMENT():
TIME_ZONE = "UTC"
USE_TZ = True
+# https://docs.djangoproject.com/en/5.0/topics/i18n/formatting/#creating-custom-format-files
+FORMAT_MODULE_PATH = [
+ "benefits.locale",
+]
+
# Static files (CSS, JavaScript, Images)
STATIC_URL = "/static/"
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/pytest/__init__.py b/tests/pytest/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/pytest/locale/__init__.py b/tests/pytest/locale/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/pytest/locale/test_formats.py b/tests/pytest/locale/test_formats.py
new file mode 100644
index 000000000..77499a42d
--- /dev/null
+++ b/tests/pytest/locale/test_formats.py
@@ -0,0 +1,36 @@
+from datetime import datetime
+
+import pytest
+
+from django.utils.formats import date_format
+
+from benefits.locale.en.formats import DATE_FORMAT as DATE_FORMAT_EN
+from benefits.locale.es.formats import DATE_FORMAT as DATE_FORMAT_ES
+
+
+@pytest.fixture
+def date_december():
+ return datetime(2024, 12, 1)
+
+
+@pytest.fixture
+def date_march():
+ return datetime(2024, 3, 1)
+
+
+def test_en_DATE_FORMAT_december(date_december):
+ assert date_format(date_december, DATE_FORMAT_EN) == "December 1, 2024"
+
+
+def test_en_DATE_FORMAT_march(date_march):
+ assert date_format(date_march, DATE_FORMAT_EN) == "March 1, 2024"
+
+
+def test_es_DATE_FORMAT_december(settings, date_december):
+ settings.LANGUAGE_CODE = "es"
+ assert date_format(date_december, DATE_FORMAT_ES) == "1 de diciembre de 2024"
+
+
+def test_es_DATE_FORMAT_march(settings, date_march):
+ settings.LANGUAGE_CODE = "es"
+ assert date_format(date_march, DATE_FORMAT_ES) == "1 de marzo de 2024"