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

34 lines
727 B
TypeScript

import { Component, Input } from '@angular/core';
import { PollService } from '../../../core/services/poll.service';
import * as moment from 'moment';
@Component({
selector: 'app-comments',
templateUrl: './comments.component.html',
styleUrls: ['./comments.component.scss'],
})
export class CommentsComponent {
@Input() public poll: any;
public config: any = {
myName: '',
myEmail: '',
myComment: '',
};
constructor(private pollService: PollService) {}
calculateDaysAgoOfComment(dateAsString) {
let numberOfDays = 0;
if (dateAsString && dateAsString) {
numberOfDays = moment(new Date()).diff(moment(new Date(dateAsString)), 'days');
}
return numberOfDays;
}
addComment() {
alert('TODO');
}
}