From ee30f64764577968f1368814c42c5a78a0b629b1 Mon Sep 17 00:00:00 2001 From: Emelia Smith Date: Thu, 5 Dec 2024 18:53:17 +0100 Subject: [PATCH] Include time portion in formatted datetimes when provided --- app/javascript/entrypoints/public.tsx | 6 +++++- app/views/admin/report_notes/_report_note.html.haml | 2 +- app/views/admin/reports/_comment.html.haml | 2 +- app/views/disputes/strikes/show.html.haml | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/javascript/entrypoints/public.tsx b/app/javascript/entrypoints/public.tsx index 9e8ff9caa1..0560e76628 100644 --- a/app/javascript/entrypoints/public.tsx +++ b/app/javascript/entrypoints/public.tsx @@ -119,7 +119,11 @@ function loaded() { formattedContent = dateFormat.format(datetime); } - content.title = formattedContent; + const timeGiven = content.dateTime.includes('T'); + content.title = timeGiven + ? dateTimeFormat.format(datetime) + : dateFormat.format(datetime); + content.textContent = formattedContent; }); diff --git a/app/views/admin/report_notes/_report_note.html.haml b/app/views/admin/report_notes/_report_note.html.haml index dd60f7eabd..9c8e267d62 100644 --- a/app/views/admin/report_notes/_report_note.html.haml +++ b/app/views/admin/report_notes/_report_note.html.haml @@ -4,7 +4,7 @@ .report-notes__item__header %span.username = link_to report_note.account.username, admin_account_path(report_note.account_id) - %time.relative-formatted{ datetime: report_note.created_at.iso8601 } + %time.relative-formatted{ datetime: report_note.created_at.iso8601, title: report_note.created_at } = l report_note.created_at.to_date .report-notes__item__content diff --git a/app/views/admin/reports/_comment.html.haml b/app/views/admin/reports/_comment.html.haml index 8c07210af9..2b3af15c49 100644 --- a/app/views/admin/reports/_comment.html.haml +++ b/app/views/admin/reports/_comment.html.haml @@ -18,7 +18,7 @@ = link_to report.account.username, admin_account_path(report.account_id) - else = link_to report.account.domain, admin_instance_path(report.account.domain) - %time.relative-formatted{ datetime: report.created_at.iso8601 } + %time.relative-formatted{ datetime: report.created_at.iso8601, title: report.created_at } = l report.created_at.to_date .report-notes__item__content = simple_format(h(report.comment)) diff --git a/app/views/disputes/strikes/show.html.haml b/app/views/disputes/strikes/show.html.haml index 150dc06759..322d820a2a 100644 --- a/app/views/disputes/strikes/show.html.haml +++ b/app/views/disputes/strikes/show.html.haml @@ -66,7 +66,7 @@ .report-notes__item__header %span.username = link_to @appeal.account.username, can?(:show, @appeal.account) ? admin_account_path(@appeal.account_id) : short_account_url(@appeal.account) - %time.relative-formatted{ datetime: @appeal.created_at.iso8601 } + %time.relative-formatted{ datetime: @appeal.created_at.iso8601, title: @appeal.created_at } = l @appeal.created_at.to_date .report-notes__item__content