forked from tykayn/funky-framadate-front
key created_at for comment, format date
This commit is contained in:
parent
e45b490c2f
commit
2d3457cf6f
@ -1,7 +1,5 @@
|
|||||||
import { User } from './user.model';
|
|
||||||
|
|
||||||
export class Comment {
|
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 {
|
public static sortChronologically(first: Comment, second: Comment): number {
|
||||||
const a = new Date(first.created_at);
|
const a = new Date(first.created_at);
|
||||||
|
@ -67,10 +67,12 @@
|
|||||||
<p>
|
<p>
|
||||||
<em class="cname"> {{ comment.pseudo }} </em>,
|
<em class="cname"> {{ comment.pseudo }} </em>,
|
||||||
|
|
||||||
<span class="date-days-ago is-small">
|
<span class="date date-days-ago">
|
||||||
il y a
|
il y a
|
||||||
{{ calculateDaysAgoOfComment(comment.date.date) }} jours, le </span
|
{{ calculateDaysAgoOfComment(comment.created_at) }} jours, le </span
|
||||||
><span class="date is-small"> {{ comment.date.date }} </span>
|
><span class="date is-small">
|
||||||
|
{{ comment.created_at | date: 'short':'Europe/Paris':'fr_FR' }}
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="message-body">
|
<div class="message-body">
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
.date {
|
||||||
|
font-size: 0.85em;
|
||||||
|
}
|
@ -17,6 +17,7 @@ export class CommentsComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
constructor(private pollService: PollService) {}
|
constructor(private pollService: PollService) {}
|
||||||
|
|
||||||
calculateDaysAgoOfComment(dateAsString) {
|
calculateDaysAgoOfComment(dateAsString) {
|
||||||
let numberOfDays = 0;
|
let numberOfDays = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user