updated datetimes based on style guide

This commit is contained in:
Beverly Nguyen
2024-03-18 15:10:26 -07:00
parent 10c9b86547
commit e9b9072ae6
12 changed files with 50 additions and 46 deletions

View File

@@ -52,7 +52,7 @@ from app.formatters import (
format_datetime_human,
format_datetime_normal,
format_datetime_relative,
format_datetime_short,
format_datetime_table,
format_day_of_week,
format_delta,
format_delta_days,
@@ -551,7 +551,7 @@ def add_template_filters(application):
format_datetime,
format_datetime_24h,
format_datetime_normal,
format_datetime_short,
format_datetime_table,
valid_phone_number,
linkable_name,
format_date,

View File

@@ -87,16 +87,15 @@ def format_time(date):
def format_datetime_normal(date):
# example: February 20, 2024 at 07:00 PM US/Eastern, used for datetimes that's not within tables
return "{} at {} {}".format(
format_date_normal(date), format_time_24h(date), get_user_preferred_timezone()
format_date_normal(date), format_time_12h(date), get_user_preferred_timezone()
)
def format_datetime_short(date):
# example: 03-18-2024 at 04:53 PM
return "{} at {}".format(
format_date_numeric(date), format_time_12h(date)
)
def format_datetime_table(date):
# example: 03-18-2024 at 04:53 PM, intended for datetimes in tables
return "{} at {}".format(format_date_numeric(date), format_time_12h(date))
def format_time_12h(date):
@@ -174,7 +173,7 @@ def format_date(date):
def format_date_normal(date):
date = parse_naive_dt(date)
return date.strftime("%d %B %Y").lstrip("0")
return date.strftime("%B %d, %Y").lstrip("0")
def format_date_short(date):

View File

@@ -18,7 +18,7 @@ from notifications_utils.template import EmailPreviewTemplate, SMSBodyPreviewTem
from app import (
current_service,
format_datetime_short,
format_datetime_table,
notification_api_client,
service_api_client,
)
@@ -93,7 +93,7 @@ def view_job_csv(service_id, job_id):
mimetype="text/csv",
headers={
"Content-Disposition": 'inline; filename="{} - {}.csv"'.format(
job.template["name"], format_datetime_short(job.created_at)
job.template["name"], format_datetime_table(job.created_at)
)
},
)

View File

@@ -171,8 +171,8 @@
{% endif %}
<p class="status-hint margin-0 width-card ">
{{ notification.status|format_notification_status_as_time(
notification.created_at|format_datetime_short,
(notification.sent_at or notification.created_at)|format_datetime_short
notification.created_at|format_datetime_table,
(notification.sent_at or notification.created_at)|format_datetime_table
) }}
</p>
{% if displayed_on_single_line %}</span>{% endif %}

View File

@@ -2,12 +2,12 @@
<p class='bottom-gutter'>
{% if job.scheduled_for %}
{% if job.processing_started %}
Sent by {{ job.created_by.name }} on {{ job.processing_started|format_datetime_short }}
Sent by {{ job.created_by.name }} on {{ job.processing_started|format_datetime_normal }}
{% else %}
Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_normal }}
{% endif %}
{% else %}
Sent by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
Sent by {{ job.created_by.name }} on {{ job.created_at|format_datetime_normal }}
{% endif %}
</p>
{% if job.status == 'sending limits exceeded'%}

View File

@@ -44,7 +44,7 @@
{% endcall %}
{% if item.expiry_date %}
{% call field(align='right') %}
<span class='hint'>Revoked {{ item.expiry_date|format_datetime_short }}</span>
<span class='hint'>Revoked {{ item.expiry_date|format_datetime_table }}</span>
{% endcall %}
{% else %}
{% call field(align='right', status='error') %}

View File

@@ -68,7 +68,7 @@
{{ notification.template.name }}
</td>
<td class="table-field time-sent">
{{ job.created_at | format_datetime_short }}
{{ job.created_at | format_datetime_table }}
</td>
<td class="table-field sender">
{{ notification.created_by.name }}

View File

@@ -29,7 +29,7 @@
{{ text_field(item.complaint_type) }}
{{ text_field(item.complaint_date|format_datetime_short if item.complaint_date else None) }}
{{ text_field(item.complaint_date|format_datetime_table if item.complaint_date else None) }}
{% endcall %}