14 lines
312 B
TypeScript
14 lines
312 B
TypeScript
export class Comment {
|
|
constructor(public author: string, public content: string, public dateCreated: Date) {}
|
|
|
|
public static sortChronologically(a: Comment, b: Comment): number {
|
|
if (a.dateCreated < b.dateCreated) {
|
|
return -1;
|
|
}
|
|
if (a.dateCreated > b.dateCreated) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
}
|