From 490266b7a2834fc27cb9e15d38bef83537ff5a7e Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 6 Aug 2021 10:33:17 +0300 Subject: [PATCH] created other branch for comments date --- .../comments/comments.component.html | 5 +- .../src/app/modules/shared/pipes/date.pipe.ts | 61 +++++++++++++++++++ apps/red-ui/src/assets/i18n/de.json | 16 +++++ apps/red-ui/src/assets/i18n/en.json | 16 +++++ 4 files changed, 97 insertions(+), 1 deletion(-) 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 b72105b3a..c6af5832f 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 @@ -2,7 +2,10 @@
{{ getOwnerName(comment) }}
-
{{ comment.date | date: 'd MMM. yyyy, hh:mm a' }}
+
+ {{ getOwnerName(comment) }} + {{ comment.date | date: 'commentDate' }} +
= thisMonth - 3) + if (isShortMonthFormat) { + const translatedMonth = this._translateService.instant(`months.${MONTH_NAMES[month]}`); + return `${day} ${translatedMonth}`; + } + + const isShortMonthYearFormat = (year === thisYear - 1) && (month < thisMonth - 3) + if (isShortMonthYearFormat) { + const translatedMonth = this._translateService.instant(`months.${MONTH_NAMES[month]}`); + return `${translatedMonth} ${year}`; + } + + return year; + } + + private _getExactCommentDate(item: string) { + const date = moment(item); + const day = date.date(); + const month = this._translateService.instant(`months.${MONTH_NAMES[date.month()]}`); + const year = date.year(); + const hour = date.hour(); + const minute = date.minute(); + + return this._translateService.instant('exact-comment-date', {day, month, year, hour, minute}); + } } diff --git a/apps/red-ui/src/assets/i18n/de.json b/apps/red-ui/src/assets/i18n/de.json index 6ae8eccfe..6ce14af7a 100644 --- a/apps/red-ui/src/assets/i18n/de.json +++ b/apps/red-ui/src/assets/i18n/de.json @@ -1238,6 +1238,22 @@ "less-than-an-hour": "", "no-time-left": "" }, + "yesterday": "", + "exact-comment-date": "", + "months": { + "jan": "", + "feb": "", + "mar": "", + "apr": "", + "may": "", + "jun": "", + "jul": "", + "aug": "", + "sep": "", + "oct": "", + "nov": "", + "dec": "" + }, "top-bar": { "navigation-items": { "back": "Zurück", diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index dc5a8a529..a7ce2794a 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1250,6 +1250,22 @@ "less-than-an-hour": "< 1 hour", "no-time-left": "Time to restore already passed" }, + "yesterday": "Yesterday", + "exact-comment-date": "{day} {month} {year} at {hour}:{minute}", + "months": { + "jan": "Jan.", + "feb": "Feb.", + "mar": "Mar.", + "apr": "Apr.", + "may": "May", + "jun": "Jun.", + "jul": "Jul.", + "aug": "Aug.", + "sep": "Sep.", + "oct": "Oct.", + "nov": "Nov.", + "dec": "Dec." + }, "top-bar": { "navigation-items": { "back": "Back",