Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/components/Datetime.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type Props = {
class?: string;
size?: "sm" | "lg";
pubDatetime: string | Date;
timezone?: string;
modDatetime?: string | Date | null;
};

Expand All @@ -22,15 +21,14 @@ const {
modDatetime,
size = "sm",
class: className = "",
timezone: postTimezone,
} = Astro.props;

const t = useTranslations(Astro.currentLocale);

const isModified = modDatetime && modDatetime > pubDatetime;

const datetime = dayjs(isModified ? modDatetime : pubDatetime).tz(
postTimezone ?? config.site.timezone
config.site.timezone
);

const date = datetime.format("D MMM, YYYY");
Expand Down
1 change: 0 additions & 1 deletion src/content.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const posts = defineCollection({
description: z.string(),
canonicalURL: z.string().optional(),
hideEditPost: z.boolean().optional(),
timezone: z.string().optional(),
}),
});

Expand Down
3 changes: 1 addition & 2 deletions src/pages/[...slug]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const {
canonicalURL,
pubDatetime,
modDatetime,
timezone,
tags,
hideEditPost,
} = post.data;
Expand Down Expand Up @@ -119,7 +118,7 @@ const ogImage = ogImageUrl
</h1>

<div class="my-2 flex items-center gap-2">
<Datetime {pubDatetime} {modDatetime} {timezone} size="lg" />
<Datetime {pubDatetime} {modDatetime} size="lg" />
<span
aria-hidden="true"
class:list={[
Expand Down