Fixed exact date pipe

This commit is contained in:
Adina Țeudan 2021-08-14 15:13:04 +03:00
parent cb56907229
commit 053c3db3b9
5 changed files with 10 additions and 14 deletions

View File

@ -1,6 +1,6 @@
<div *ngFor="let comment of annotation.comments" class="comment">
<div class="comment-details-wrapper">
<div [matTooltipPosition]="'above'" [matTooltip]="comment.date | date: 'exactCommentDate'" class="small-label">
<div [matTooltipPosition]="'above'" [matTooltip]="comment.date | date: 'exactDate'" class="small-label">
<b> {{ getOwnerName(comment) }} </b>
{{ comment.date | date: 'commentDate' }}
</div>

View File

@ -18,11 +18,7 @@
></redaction-empty-state>
<cdk-virtual-scroll-viewport *ngIf="(entitiesService.noData$ | async) === false" [itemSize]="itemSize" redactionHasScrollbar>
<div
*cdkVirtualFor="let file of sortedDisplayedEntities$ | async; trackBy: trackByPrimaryKey"
[class.pointer]="!!file"
class="table-item"
>
<div *cdkVirtualFor="let file of sortedDisplayedEntities$ | async; trackBy: trackByPrimaryKey" class="table-item">
<div (click)="toggleEntitySelected($event, file)" class="selection-column">
<iqser-round-checkbox [active]="isSelected(file)"></iqser-round-checkbox>
</div>
@ -35,7 +31,7 @@
{{ file.numberOfPages }}
</div>
</div>
<div class="small-label">{{ file.softDeleted | date: 'd MMM. yyyy, HH:mm' }}</div>
<div class="small-label">{{ file.softDeleted | date: 'exactDate' }}</div>
<div>
<div class="small-label">{{ file.restoreDate | date: 'timeFromNow' }}</div>
<div class="action-buttons">

View File

@ -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,

View File

@ -1239,7 +1239,7 @@
"no-time-left": ""
},
"yesterday": "",
"exact-comment-date": "",
"exact-date": "",
"months": {
"jan": "",
"feb": "",

View File

@ -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",