funky-framadate-front/src/app/shared/components/comments/comments.component.ts

34 lines
727 B
TypeScript
Raw Normal View History

2021-04-26 10:32:42 +02:00
import { Component, Input } from '@angular/core';
2020-05-01 19:10:17 +02:00
import { PollService } from '../../../core/services/poll.service';
2021-04-26 10:32:42 +02:00
import * as moment from 'moment';
2020-05-01 19:10:17 +02:00
@Component({
2020-05-12 19:16:23 +02:00
selector: 'app-comments',
templateUrl: './comments.component.html',
styleUrls: ['./comments.component.scss'],
2020-05-01 19:10:17 +02:00
})
2020-05-12 19:16:23 +02:00
export class CommentsComponent {
2021-04-26 10:32:42 +02:00
@Input() public poll: any;
public config: any = {
myName: '',
myEmail: '',
myComment: '',
};
2020-05-01 19:10:17 +02:00
2020-05-05 18:17:12 +02:00
constructor(private pollService: PollService) {}
2021-04-26 10:32:42 +02:00
calculateDaysAgoOfComment(dateAsString) {
let numberOfDays = 0;
if (dateAsString && dateAsString) {
numberOfDays = moment(new Date()).diff(moment(new Date(dateAsString)), 'days');
}
return numberOfDays;
}
addComment() {
alert('TODO');
}
2020-05-01 19:10:17 +02:00
}