]> Untitled Git - lemmy.git/blobdiff - ui/src/components/cake-day.tsx
routes.api: fix get_captcha endpoint (#1135)
[lemmy.git] / ui / src / components / cake-day.tsx
index 67ac7f8bf62c6ab1f98fe055daa5a57c552cf6c9..f28be33c204e5fe17ae819a3cebb8e3d2120a335 100644 (file)
@@ -1,41 +1,25 @@
 import { Component } from 'inferno';
-import moment from 'moment';
 import { i18n } from '../i18next';
 
 interface CakeDayProps {
-  creator_name: string;
-  creator_published: string;
+  creatorName: string;
 }
 
 export class CakeDay extends Component<CakeDayProps, any> {
   render() {
-    const { creator_name, creator_published } = this.props;
-
-    return (
-      this.isCakeDay(creator_published) && (
-        <div
-          className="mr-lg-2 d-inline-block unselectable pointer mx-2"
-          data-tippy-content={this.cakeDayTippy(creator_name)}
-        >
-          <svg class="icon icon-inline">
-            <use xlinkHref="#icon-cake"></use>
-          </svg>
-        </div>
-      )
-    );
-  }
-
-  isCakeDay(input: string): boolean {
-    const userCreationDate = moment.utc(input).local();
-    const currentDate = moment(new Date());
-
     return (
-      userCreationDate.date() === currentDate.date() &&
-      userCreationDate.month() === currentDate.month()
+      <div
+        className={`mx-2 d-inline-block unselectable pointer`}
+        data-tippy-content={this.cakeDayTippy()}
+      >
+        <svg class="icon icon-inline">
+          <use xlinkHref="#icon-cake"></use>
+        </svg>
+      </div>
     );
   }
 
-  cakeDayTippy(creator_name: string): string {
-    return i18n.t('cake_day_info', { creator_name });
+  cakeDayTippy(): string {
+    return i18n.t('cake_day_info', { creator_name: this.props.creatorName });
   }
 }