diff --git a/src/layouts/BlogPostLayout.astro b/src/layouts/BlogPostLayout.astro index 81e9233..989d193 100644 --- a/src/layouts/BlogPostLayout.astro +++ b/src/layouts/BlogPostLayout.astro @@ -7,13 +7,13 @@ import dayjs from "dayjs"; import timezone from "dayjs/plugin/timezone"; import utc from "dayjs/plugin/utc"; +dayjs.extend(utc); +dayjs.extend(timezone); + import BaseLayout from "./BaseLayout.astro"; const { frontmatter, readingTime } = Astro.props; -dayjs.extend(utc); -dayjs.extend(timezone); - const formattedLastModified = dayjs(frontmatter.lastModified) .utc() .tz("Europe/Paris") diff --git a/src/layouts/MarkdownPageLayout.astro b/src/layouts/MarkdownPageLayout.astro index 2110d28..f285bcc 100644 --- a/src/layouts/MarkdownPageLayout.astro +++ b/src/layouts/MarkdownPageLayout.astro @@ -3,13 +3,13 @@ import dayjs from "dayjs"; import timezone from "dayjs/plugin/timezone"; import utc from "dayjs/plugin/utc"; +dayjs.extend(utc); +dayjs.extend(timezone); + import BaseLayout from "./BaseLayout.astro"; const { frontmatter } = Astro.props; -dayjs.extend(utc); -dayjs.extend(timezone); - const lastModified = dayjs(frontmatter.lastModified) .utc() .tz("Europe/Paris") diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 790341b..f29d0a8 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -1,10 +1,6 @@ --- import BlogPostLayout from "@/layouts/BlogPostLayout.astro"; import { getCollection } from "astro:content"; -import dayjs from "dayjs"; -import timezone from "dayjs/plugin/timezone"; - -dayjs.extend(timezone); export async function getStaticPaths() { const blogEntries = await getCollection("posts"); @@ -16,15 +12,10 @@ export async function getStaticPaths() { const { entry } = Astro.props; const { Content, remarkPluginFrontmatter } = await entry.render(); - -const lastModified = dayjs(remarkPluginFrontmatter.lastModified) - .tz("Europe/Paris") - .format("DD MMMM YYYY HH:mm:ss"); ---