From fc83925146c9264054b346e4a6457f26cc5d8882 Mon Sep 17 00:00:00 2001 From: Johnnadel Salita Uy Date: Fri, 21 Jun 2024 14:11:44 +0200 Subject: [PATCH] [MIM-1762] Add checkbox to toggle time for modified date for statistics (#2808) Add checkbox to toggle time for modified date for statistics --- .../resources/site/content-types/statistics/statistics.xml | 6 +++++- src/main/resources/site/parts/statistics/statistics.ts | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/resources/site/content-types/statistics/statistics.xml b/src/main/resources/site/content-types/statistics/statistics.xml index 16e7f8316..f2e0d8aad 100644 --- a/src/main/resources/site/content-types/statistics/statistics.xml +++ b/src/main/resources/site/content-types/statistics/statistics.xml @@ -15,6 +15,10 @@ true + + + unchecked + @@ -134,4 +138,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/site/parts/statistics/statistics.ts b/src/main/resources/site/parts/statistics/statistics.ts index 177d1372b..c1974e21c 100644 --- a/src/main/resources/site/parts/statistics/statistics.ts +++ b/src/main/resources/site/parts/statistics/statistics.ts @@ -65,6 +65,7 @@ function renderPart(req: XP.Request): XP.Response { const modifiedText: string | undefined = page.data.showModifiedDate ? page.data.showModifiedDate.modifiedOption.modifiedText : undefined + const showModifiedTime: boolean | undefined = page.data.showModifiedDate?.modifiedOption.showModifiedTime const modifiedDate: string | undefined = page.data.showModifiedDate ? page.data.showModifiedDate.modifiedOption.lastModified : undefined @@ -118,7 +119,8 @@ function renderPart(req: XP.Request): XP.Response { if (page.data.showModifiedDate && previousReleaseDate && modifiedDate) { if (isAfter(new Date(modifiedDate), new Date(previousReleaseDate))) { - changeDate = formatDate(modifiedDate, 'PPp', language) + const dateFormat = showModifiedTime ? 'PPp' : 'PPP' + changeDate = formatDate(modifiedDate, dateFormat, language) } }