This commit is contained in:
Viet An
2026-05-27 14:14:02 +07:00
parent 29ff3f2598
commit 5e958e4166
8 changed files with 711 additions and 24 deletions

View File

@@ -249,10 +249,10 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { formatDistanceToNow } from "date-fns";
import axios from "axios";
import { useNuxtApp } from "nuxt/app";
import { apiUrl } from "@/components/marketing/email/Email.utils";
import type dayjs from "dayjs";
interface EmailSent {
id: number;
@@ -266,6 +266,7 @@ interface EmailSent {
const nuxtApp = useNuxtApp();
const $snackbar = nuxtApp.$snackbar as (message?: string) => void;
const $dayjs = nuxtApp.$dayjs as (date?: string | Date) => ReturnType<typeof dayjs>;
const emailsSent = ref<EmailSent[]>([]);
const loading = ref(true);
@@ -343,7 +344,7 @@ const formatDate = (dateString: string) => {
const getRelativeTime = (dateString: string) => {
try {
if (dateString === "") return "";
return formatDistanceToNow(new Date(dateString), { addSuffix: true });
return $dayjs(new Date(dateString)).fromNow();
} catch {
return "";
}