updated date pipe logic for "shophisticatedDate" branch

This commit is contained in:
Valentin 2021-12-06 22:58:57 +02:00
parent 1f8096399a
commit e04d8534b7

View File

@ -90,13 +90,15 @@ export class DatePipe extends BaseDatePipe implements PipeTransform {
return this._translateService.instant('yesterday');
}
const isShortMonthFormat = day < thisDay - 1 && (year === thisYear || month >= thisMonth - 3);
const isShortMonthFormat =
year === thisYear &&
((month === thisMonth && day !== thisDay && day !== thisDay - 1) || (month !== thisMonth && month >= thisMonth - 2));
if (isShortMonthFormat) {
const translatedMonth = this._translateService.instant(MONTH_NAMES[month]);
return `${day} ${translatedMonth}`;
}
const isShortMonthYearFormat = year === thisYear - 1 && month < thisMonth - 3;
const isShortMonthYearFormat = (year === thisYear && month <= thisMonth - 3) || year === thisYear - 1;
if (isShortMonthYearFormat) {
const translatedMonth = this._translateService.instant(MONTH_NAMES[month]);
return `${translatedMonth} ${year}`;