From 6f2e2e5ed19ee149d25ddc490085422b496e0ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de> Date: Fri, 10 Jan 2020 16:36:36 +0100 Subject: [PATCH] Add date to comment timestamp --- src/app/components/shared/comment/comment.component.html | 6 ++++-- src/app/components/shared/comment/comment.component.ts | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/components/shared/comment/comment.component.html b/src/app/components/shared/comment/comment.component.html index 17c8eeedf..af0ab6000 100644 --- a/src/app/components/shared/comment/comment.component.html +++ b/src/app/components/shared/comment/comment.component.html @@ -5,10 +5,12 @@ <div fxLayout="row" class="comment-actions"> <div class="date-container"> <div class="date" *ngIf="language === 'de'; else englishDate"> - {{comment.timestamp | date: ' HH:mm '}} + {{deviceType === 'desktop' ? (comment.timestamp | date: ' dd.MM.yy | HH:mm ') : + (comment.timestamp | date: ' HH:mm ')}} </div> <ng-template class="date" #englishDate> - {{comment.timestamp | date: 'h:mm a'}} + {{deviceType === 'desktop' ? (comment.timestamp | date: ' M/d/yy | h:mm a ') : + (comment.timestamp | date: ' h:mm a ')}} </ng-template> </div> <button mat-icon-button *ngIf="comment.read" [disabled]="true" (click)="setRead(comment)"> diff --git a/src/app/components/shared/comment/comment.component.ts b/src/app/components/shared/comment/comment.component.ts index 33510bff3..ac7502a6c 100644 --- a/src/app/components/shared/comment/comment.component.ts +++ b/src/app/components/shared/comment/comment.component.ts @@ -56,6 +56,7 @@ export class CommentComponent implements OnInit { hasVoted = 0; language: string; animationState: string; + deviceType: string; constructor(protected authenticationService: AuthenticationService, private route: ActivatedRoute, @@ -85,6 +86,7 @@ export class CommentComponent implements OnInit { } this.language = localStorage.getItem('currentLang'); this.translateService.use(this.language); + this.deviceType = localStorage.getItem('deviceType'); } startAnimation(state_: any): void { -- GitLab