From 053c3db3b98bcc59e1dc08d7cca9a663f635f108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Sat, 14 Aug 2021 15:13:04 +0300 Subject: [PATCH] Fixed exact date pipe --- .../components/comments/comments.component.html | 2 +- .../edit-dossier-deleted-documents.component.html | 8 ++------ apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts | 10 +++++----- apps/red-ui/src/assets/i18n/de.json | 2 +- apps/red-ui/src/assets/i18n/en.json | 2 +- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier/components/comments/comments.component.html b/apps/red-ui/src/app/modules/dossier/components/comments/comments.component.html index e1431f031..c5d74ae01 100644 --- a/apps/red-ui/src/app/modules/dossier/components/comments/comments.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/comments/comments.component.html @@ -1,6 +1,6 @@
-
+
{{ getOwnerName(comment) }} {{ comment.date | date: 'commentDate' }}
diff --git a/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/deleted-documents/edit-dossier-deleted-documents.component.html b/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/deleted-documents/edit-dossier-deleted-documents.component.html index e71fa5686..942ff9740 100644 --- a/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/deleted-documents/edit-dossier-deleted-documents.component.html +++ b/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/deleted-documents/edit-dossier-deleted-documents.component.html @@ -18,11 +18,7 @@ > -
+
@@ -35,7 +31,7 @@ {{ file.numberOfPages }}
-
{{ file.softDeleted | date: 'd MMM. yyyy, HH:mm' }}
+
{{ file.softDeleted | date: 'exactDate' }}
{{ file.restoreDate | date: 'timeFromNow' }}
diff --git a/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts b/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts index 84643a23a..37cbd7e55 100644 --- a/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts +++ b/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts @@ -33,7 +33,7 @@ export class DatePipe extends BaseDatePipe implements PipeTransform { transform(value: any, format?: string, timezone?: string, locale?: string): string { if (format === 'timeFromNow') return this._getTimeFromNow(value); if (format === 'commentDate') return this._getCommentDate(value); - if (format === 'exactCommentDate') return this._getExactCommentDate(value); + if (format === 'exactDate') return this._getExactDate(value); return super.transform(value, format, timezone, locale); } @@ -87,15 +87,15 @@ export class DatePipe extends BaseDatePipe implements PipeTransform { return year; } - private _getExactCommentDate(item: string) { + private _getExactDate(item: string) { const date = moment(item); const day = date.date(); const month = this._translateService.instant(MONTH_NAMES[date.month()]); const year = date.year(); - const hour = date.hour(); - const minute = date.minute(); + const hour = date.hour().toString(10).padStart(2, '0'); + const minute = date.minute().toString(10).padStart(2, '0'); - return this._translateService.instant('exact-comment-date', { + return this._translateService.instant('exact-date', { day, month, year, diff --git a/apps/red-ui/src/assets/i18n/de.json b/apps/red-ui/src/assets/i18n/de.json index 19b17b1e8..0028d47d0 100644 --- a/apps/red-ui/src/assets/i18n/de.json +++ b/apps/red-ui/src/assets/i18n/de.json @@ -1239,7 +1239,7 @@ "no-time-left": "" }, "yesterday": "", - "exact-comment-date": "", + "exact-date": "", "months": { "jan": "", "feb": "", diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 5cfc2d868..2df90f610 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -834,7 +834,7 @@ "side-nav-title": "Configurations", "unsaved-changes": "You have unsaved changes. Save or revert before changing the tab." }, - "exact-comment-date": "{day} {month} {year} at {hour}:{minute}", + "exact-date": "{day} {month} {year} at {hour}:{minute}", "file-attribute-types": { "date": "Date", "number": "Number",