diff --git a/src/app/core/models/comment.model.ts b/src/app/core/models/comment.model.ts index 0cce1157..8b9f939b 100644 --- a/src/app/core/models/comment.model.ts +++ b/src/app/core/models/comment.model.ts @@ -1,7 +1,5 @@ -import { User } from './user.model'; - export class Comment { - constructor(public text: string, public pseudo: string, public created_at: string) {} + constructor(public id: string, public text: string, public pseudo: string, public created_at: string) {} public static sortChronologically(first: Comment, second: Comment): number { const a = new Date(first.created_at); diff --git a/src/app/shared/components/comments/comments.component.html b/src/app/shared/components/comments/comments.component.html index 22bd3962..f3ca856e 100644 --- a/src/app/shared/components/comments/comments.component.html +++ b/src/app/shared/components/comments/comments.component.html @@ -67,10 +67,12 @@

{{ comment.pseudo }} , - + il y a - {{ calculateDaysAgoOfComment(comment.date.date) }} jours, le {{ comment.date.date }} + {{ calculateDaysAgoOfComment(comment.created_at) }} jours, le + {{ comment.created_at | date: 'short':'Europe/Paris':'fr_FR' }} +

diff --git a/src/app/shared/components/comments/comments.component.scss b/src/app/shared/components/comments/comments.component.scss index e69de29b..7cfdd368 100644 --- a/src/app/shared/components/comments/comments.component.scss +++ b/src/app/shared/components/comments/comments.component.scss @@ -0,0 +1,3 @@ +.date { + font-size: 0.85em; +} diff --git a/src/app/shared/components/comments/comments.component.ts b/src/app/shared/components/comments/comments.component.ts index 7de1c384..086fef07 100644 --- a/src/app/shared/components/comments/comments.component.ts +++ b/src/app/shared/components/comments/comments.component.ts @@ -17,6 +17,7 @@ export class CommentsComponent { }; constructor(private pollService: PollService) {} + calculateDaysAgoOfComment(dateAsString) { let numberOfDays = 0;