diff --git a/src/components/BlogHeader.astro b/src/components/BlogHeader.astro
index 28d076d..505f2d3 100644
--- a/src/components/BlogHeader.astro
+++ b/src/components/BlogHeader.astro
@@ -1,5 +1,6 @@
---
-import { format } from "date-fns-tz";
+import { format, add } from "date-fns";
+import FormattedDate from "@components/FormattedDate.astro";
interface Props {
title: String;
@@ -12,6 +13,6 @@ const { title, date } = Astro.props;
diff --git a/src/components/FormattedDate.astro b/src/components/FormattedDate.astro
new file mode 100644
index 0000000..4634c49
--- /dev/null
+++ b/src/components/FormattedDate.astro
@@ -0,0 +1,11 @@
+---
+import { format, add } from "date-fns";
+
+interface Props {
+ date: String;
+}
+
+const { date } = Astro.props;
+---
+
+{format(add(new Date(date), { hours: 6 }), "MMM do, y")}
diff --git a/src/pages/archive.astro b/src/pages/archive.astro
index 40e230c..e017e15 100644
--- a/src/pages/archive.astro
+++ b/src/pages/archive.astro
@@ -1,8 +1,13 @@
---
import { formatInTimeZone } from "date-fns-tz";
import Layout from "@layouts/Layout.astro";
+import FormattedDate from "@components/FormattedDate.astro";
const posts = await Astro.glob("./posts/*.md");
+posts.sort(
+ (a, b) =>
+ Date.parse(b.frontmatter.pubDate) - Date.parse(a.frontmatter.pubDate)
+);
---
@@ -10,11 +15,7 @@ const posts = await Astro.glob("./posts/*.md");
posts.map((post) => (
{post.frontmatter.title} -{" "}
- {formatInTimeZone(
- new Date(post.frontmatter.pubDate),
- "America/New_York",
- "MMM do, y"
- )}
+
))
}
diff --git a/src/pages/index.astro b/src/pages/index.astro
index a76d28e..6cbc23a 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -5,11 +5,15 @@ import Layout from "@layouts/Layout.astro";
import BlogHeader from "@components/BlogHeader.astro";
const posts = await Astro.glob("./posts/*.md");
+posts.sort(
+ (a, b) =>
+ Date.parse(b.frontmatter.pubDate) - Date.parse(a.frontmatter.pubDate)
+);
---
{
- posts.map((post) => (
+ posts.slice(0, 5).map((post) => (