Guest User

Untitled

a guest
Mar 22nd, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. export class User {
  2. uid: number;
  3. name: string;
  4.  
  5. constructor(uid: number, name: string) {
  6. this.uid = uid;
  7. this.name = name;
  8. }
  9. }
  10.  
  11. export class Comment {
  12. user: User;
  13. initial: string;
  14. content: string;
  15. date: String;
  16.  
  17. constructor(user: User, content: string) {
  18. this.user = user;
  19. this.initial = user.name.slice(0, 1);
  20. this.content = content;
  21. this.date = new Date().toISOString();
  22. }
  23.  
  24. // 取得した日付を反映
  25. setData(date: string): Comment {
  26. this.date = date;
  27. return this;
  28. }
  29. }
Add Comment
Please, Sign In to add comment