2021-02-12 18:19:49 +01:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<p class="time">
|
|
|
|
{{
|
2022-07-12 10:55:28 +02:00
|
|
|
formatDistanceToNow(new Date(event.publishAt), {
|
|
|
|
locale: dateFnsLocale,
|
2021-02-12 18:19:49 +01:00
|
|
|
addSuffix: true,
|
|
|
|
}) || $t("Right now")
|
|
|
|
}}
|
|
|
|
</p>
|
|
|
|
<EventCard :event="event" />
|
|
|
|
</div>
|
|
|
|
</template>
|
2022-07-12 10:55:28 +02:00
|
|
|
<script lang="ts" setup>
|
2021-02-12 18:19:49 +01:00
|
|
|
import { IEvent } from "@/types/event.model";
|
|
|
|
import { formatDistanceToNow } from "date-fns";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { inject } from "vue";
|
2021-02-12 18:19:49 +01:00
|
|
|
import EventCard from "./EventCard.vue";
|
2022-07-12 10:55:28 +02:00
|
|
|
import type { Locale } from "date-fns";
|
2022-07-12 10:55:28 +02:00
|
|
|
defineProps<{
|
|
|
|
event: IEvent;
|
|
|
|
}>();
|
2021-02-12 18:19:49 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const dateFnsLocale = inject<Locale>("dateFnsLocale");
|
2021-02-12 18:19:49 +01:00
|
|
|
</script>
|