1 import { Component } from 'inferno';
2 import moment from 'moment';
3 import { i18n } from '../i18next';
5 interface CakeDayProps {
7 creator_published: string;
10 export class CakeDay extends Component<CakeDayProps, any> {
12 const { creator_name, creator_published } = this.props;
15 this.isCakeDay(creator_published) && (
17 className="mr-lg-2 d-inline-block unselectable pointer mx-2"
18 data-tippy-content={this.cakeDayTippy(creator_name)}
20 <svg class="icon icon-inline">
21 <use xlinkHref="#icon-cake"></use>
28 isCakeDay(input: string): boolean {
29 const userCreationDate = moment.utc(input).local();
30 const currentDate = moment(new Date());
33 userCreationDate.date() === currentDate.date() &&
34 userCreationDate.month() === currentDate.month()
38 cakeDayTippy(creator_name: string): string {
39 return i18n.t('cake_day_info', { creator_name });