--- import { t, astroI18n } from "astro-i18n"; astroI18n.init(Astro); const { item } = Astro.props; function formatDate(date) { const options = { year: "numeric", month: "long", day: "numeric" }; return new Date(date).toLocaleDateString(astroI18n.langCode, options); } // Needed because browser will transform the value to a readable english date in 'datetime' if not forced // see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time#attr-datetime for valid formats function rawDate(date) { return new Date(date).toISOString(); } ---
{ !!item.createdAt && (

{t("meta.publication")} :

) } { formatDate(item.createdAt) != formatDate(item.updatedAt) && !!item.createdAt && !!item.updatedAt && (

{t("meta.modification")} :

) } { !item.createdAt && !!item.updatedAt && (

{t("meta.modification")} :

) }