mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 17:09:49 -04:00
updating datetimes to match styleguides
This commit is contained in:
@@ -53,7 +53,6 @@ from app.formatters import (
|
|||||||
format_datetime_normal,
|
format_datetime_normal,
|
||||||
format_datetime_relative,
|
format_datetime_relative,
|
||||||
format_datetime_short,
|
format_datetime_short,
|
||||||
format_datetime_short_america,
|
|
||||||
format_day_of_week,
|
format_day_of_week,
|
||||||
format_delta,
|
format_delta,
|
||||||
format_delta_days,
|
format_delta_days,
|
||||||
@@ -553,7 +552,6 @@ def add_template_filters(application):
|
|||||||
format_datetime_24h,
|
format_datetime_24h,
|
||||||
format_datetime_normal,
|
format_datetime_normal,
|
||||||
format_datetime_short,
|
format_datetime_short,
|
||||||
format_datetime_short_america,
|
|
||||||
valid_phone_number,
|
valid_phone_number,
|
||||||
linkable_name,
|
linkable_name,
|
||||||
format_date,
|
format_date,
|
||||||
|
|||||||
@@ -93,21 +93,9 @@ def format_datetime_normal(date):
|
|||||||
|
|
||||||
|
|
||||||
def format_datetime_short(date):
|
def format_datetime_short(date):
|
||||||
return "{} at {} {}".format(
|
# example: 03-18-2024 at 04:53 PM
|
||||||
format_date_short(date), format_time_24h(date), get_user_preferred_timezone()
|
return "{} at {}".format(
|
||||||
)
|
format_date_numeric(date), format_time_12h(date)
|
||||||
|
|
||||||
|
|
||||||
def format_datetime_short_america(date):
|
|
||||||
return "{} at {}".format(format_date_numeric_america(date), format_time_12h(date))
|
|
||||||
|
|
||||||
|
|
||||||
def format_date_numeric_america(date):
|
|
||||||
date = parse_naive_dt(date)
|
|
||||||
|
|
||||||
preferred_tz = pytz.timezone(get_user_preferred_timezone())
|
|
||||||
return (
|
|
||||||
date.replace(tzinfo=timezone.utc).astimezone(preferred_tz).strftime("%m-%d-%Y")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -137,7 +125,7 @@ def format_date_numeric(date):
|
|||||||
|
|
||||||
preferred_tz = pytz.timezone(get_user_preferred_timezone())
|
preferred_tz = pytz.timezone(get_user_preferred_timezone())
|
||||||
return (
|
return (
|
||||||
date.replace(tzinfo=timezone.utc).astimezone(preferred_tz).strftime("%Y-%m-%d")
|
date.replace(tzinfo=timezone.utc).astimezone(preferred_tz).strftime("%m-%d-%Y")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -171,8 +171,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<p class="status-hint margin-0 width-card ">
|
<p class="status-hint margin-0 width-card ">
|
||||||
{{ notification.status|format_notification_status_as_time(
|
{{ notification.status|format_notification_status_as_time(
|
||||||
notification.created_at|format_datetime_short_america,
|
notification.created_at|format_datetime_short,
|
||||||
(notification.sent_at or notification.created_at)|format_datetime_short_america
|
(notification.sent_at or notification.created_at)|format_datetime_short
|
||||||
) }}
|
) }}
|
||||||
</p>
|
</p>
|
||||||
{% if displayed_on_single_line %}</span>{% endif %}
|
{% if displayed_on_single_line %}</span>{% endif %}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
<p class='bottom-gutter'>
|
<p class='bottom-gutter'>
|
||||||
{% if job.scheduled_for %}
|
{% if job.scheduled_for %}
|
||||||
{% if job.processing_started %}
|
{% if job.processing_started %}
|
||||||
Sent by {{ job.created_by.name }} on {{ job.processing_started|format_datetime_short_america }}
|
Sent by {{ job.created_by.name }} on {{ job.processing_started|format_datetime_short }}
|
||||||
{% else %}
|
{% else %}
|
||||||
Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short_america }}
|
Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
Sent by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short_america }}
|
Sent by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
{% if job.status == 'sending limits exceeded'%}
|
{% if job.status == 'sending limits exceeded'%}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
{{ notification.template.name }}
|
{{ notification.template.name }}
|
||||||
</td>
|
</td>
|
||||||
<td class="table-field time-sent">
|
<td class="table-field time-sent">
|
||||||
{{ job.created_at | format_datetime_short_america }}
|
{{ job.created_at | format_datetime_short }}
|
||||||
</td>
|
</td>
|
||||||
<td class="table-field sender">
|
<td class="table-field sender">
|
||||||
{{ notification.created_by.name }}
|
{{ notification.created_by.name }}
|
||||||
|
|||||||
Reference in New Issue
Block a user