From 7a995cf40251688a811796b06046780ec1e52fba Mon Sep 17 00:00:00 2001 From: josh Date: Fri, 9 Jun 2023 22:55:21 -0400 Subject: [PATCH] Use luxon for DateTime Signed-off-by: josh --- .../EntityNomadAllocationListTable.tsx | 6 +++++- .../EntityNomadJobVersionListCard.tsx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/nomad/src/components/EntityNomadAllocationListTable/EntityNomadAllocationListTable.tsx b/plugins/nomad/src/components/EntityNomadAllocationListTable/EntityNomadAllocationListTable.tsx index bd577f555b..6d7a79c002 100644 --- a/plugins/nomad/src/components/EntityNomadAllocationListTable/EntityNomadAllocationListTable.tsx +++ b/plugins/nomad/src/components/EntityNomadAllocationListTable/EntityNomadAllocationListTable.tsx @@ -14,6 +14,7 @@ * limitations under the License. */ +import { DateTime } from 'luxon'; import { Link, MissingAnnotationEmptyState, @@ -64,7 +65,10 @@ const columns: TableColumn[] = [ { title: 'Created', field: 'CreateTime', - render: row => new Date(row.CreateTime / 1000000).toLocaleString(), + render: row => + DateTime.fromMillis(row.CreateTime / 1000000).toLocaleString( + DateTime.DATETIME_MED_WITH_SECONDS, + ), }, { title: 'Status', diff --git a/plugins/nomad/src/components/EntityNomadJobVersionListCard/EntityNomadJobVersionListCard.tsx b/plugins/nomad/src/components/EntityNomadJobVersionListCard/EntityNomadJobVersionListCard.tsx index c4dad1f455..c40a7fbeed 100644 --- a/plugins/nomad/src/components/EntityNomadJobVersionListCard/EntityNomadJobVersionListCard.tsx +++ b/plugins/nomad/src/components/EntityNomadJobVersionListCard/EntityNomadJobVersionListCard.tsx @@ -14,6 +14,7 @@ * limitations under the License. */ +import { DateTime } from 'luxon'; import { InfoCard, MissingAnnotationEmptyState, @@ -49,7 +50,10 @@ const columns: TableColumn[] = [ { title: 'Submitted', field: 'SubmitTime', - render: row => new Date(row.SubmitTime / 1000000).toLocaleString(), + render: row => + DateTime.fromMillis(row.SubmitTime / 1000000).toLocaleString( + DateTime.DATETIME_MED_WITH_SECONDS, + ), }, ];