From 9e86229d804c072d53679bd74a7eb4a9fc385ed8 Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Thu, 5 Dec 2019 15:27:59 +0100 Subject: [PATCH] FIX #12091 TIME 0:15 fix date pipe (nb days) --- src/frontend/app/list/basket-list.component.html | 6 +++--- src/frontend/plugins/fullDate.pipe.ts | 2 +- src/frontend/plugins/timeAgo.pipe.ts | 9 +++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/frontend/app/list/basket-list.component.html b/src/frontend/app/list/basket-list.component.html index 49b530af1cd..54989d48123 100644 --- a/src/frontend/app/list/basket-list.component.html +++ b/src/frontend/app/list/basket-list.component.html @@ -80,17 +80,17 @@ <ng-container *ngIf="row.closing_date != lang.undefined"> <i class="fa fa-lock" title="{{lang.closingDate}}"></i> <span [innerHTML]="row.closing_date | timeAgo" - title='{{row.closing_date | date : lang.onRange + " dd/MM/y " + lang.atRange +" HH:mm"}}'></span> + title='{{row.closing_date | fullDate}}'></span> </ng-container> <ng-container *ngIf="row.closing_date == lang.undefined"> <i class="fa fa-calendar" title="{{lang.creationDate}}"></i> <span [innerHTML]="data.displayValue.creationDate | timeAgo" - title='{{data.displayValue.creationDate | date : lang.onRange + " dd/MM/y " + lang.atRange +" HH:mm"}}'></span> + title='{{data.displayValue.creationDate | fullDate}}'></span> - <i class="fa fa-stopwatch" title="{{lang.processLimitDate}}"></i> <span [innerHTML]="data.displayValue.processLimitDate | timeLimit" - title='{{data.displayValue.processLimitDate | date : lang.onRange + " dd/MM/y " + lang.atRange +" HH:mm"}}'></span> + title='{{data.displayValue.processLimitDate | fullDate}}'></span> </ng-container> </ng-container> <ng-container *ngIf="data.icon != ''"> diff --git a/src/frontend/plugins/fullDate.pipe.ts b/src/frontend/plugins/fullDate.pipe.ts index 3fc7d7ba6a7..bcda977f131 100755 --- a/src/frontend/plugins/fullDate.pipe.ts +++ b/src/frontend/plugins/fullDate.pipe.ts @@ -11,6 +11,6 @@ export class FullDatePipe implements PipeTransform { transform(value: string) { const date = new Date(value); const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' }; - return this.lang.onRange + ' ' + date.toLocaleDateString('fr-FR', options); + return this.lang.onRange[0].toUpperCase() + this.lang.onRange.substr(1).toLowerCase() + ' ' + date.toLocaleDateString('fr-FR', options); } } \ No newline at end of file diff --git a/src/frontend/plugins/timeAgo.pipe.ts b/src/frontend/plugins/timeAgo.pipe.ts index 36283f766f7..69fbdbf046c 100755 --- a/src/frontend/plugins/timeAgo.pipe.ts +++ b/src/frontend/plugins/timeAgo.pipe.ts @@ -63,14 +63,11 @@ export class TimeAgoPipe implements PipeTransform, OnDestroy { return this.getFormatedDate(this.lang.at.toLowerCase(), hourNumber + ':' + minuteNumber, args); //return hours + ' heures'; } else if (hours <= 24) { - return this.getFormatedDate(this.lang.dateTo.toLowerCase(), dayNumber + ' ' + month[d.getMonth()], args); + return this.getFormatedDate(this.lang.dateAgo.toLowerCase(), days + ' ' + this.lang.dayS, args); //return 'un jour'; - } else if (days <= 25) { - return this.getFormatedDate(this.lang.dateTo.toLowerCase(), d.getDate() + ' ' + month[d.getMonth()], args); + } else if (days <= 5) { + return this.getFormatedDate(this.lang.dateAgo.toLowerCase(), days + ' ' + this.lang.dayS, args); //return days + ' jours'; - } else if (days <= 45) { - return this.getFormatedDate(this.lang.dateTo.toLowerCase(), d.getDate() + ' ' + month[d.getMonth()], args); - //return 'un mois'; } else if (days <= 345) { return this.getFormatedDate(this.lang.dateTo.toLowerCase(), d.getDate() + ' ' + month[d.getMonth()], args); //return months + ' mois'; -- GitLab