post sorting and date fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
import { format } from "date-fns-tz";
|
import { format, add } from "date-fns";
|
||||||
|
import FormattedDate from "@components/FormattedDate.astro";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: String;
|
title: String;
|
||||||
@@ -12,6 +13,6 @@ const { title, date } = Astro.props;
|
|||||||
<div class="blog-header">
|
<div class="blog-header">
|
||||||
<h2>{title}</h2>
|
<h2>{title}</h2>
|
||||||
<h3 style={{ fontSize: "1.1rem" }}>
|
<h3 style={{ fontSize: "1.1rem" }}>
|
||||||
{`🗓️ ${format(new Date(date), "MMM do, y")}`}
|
🗓️ <FormattedDate date={date} />
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
import { format, add } from "date-fns";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
date: String;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { date } = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<span>{format(add(new Date(date), { hours: 6 }), "MMM do, y")}</span>
|
||||||
@@ -1,8 +1,13 @@
|
|||||||
---
|
---
|
||||||
import { formatInTimeZone } from "date-fns-tz";
|
import { formatInTimeZone } from "date-fns-tz";
|
||||||
import Layout from "@layouts/Layout.astro";
|
import Layout from "@layouts/Layout.astro";
|
||||||
|
import FormattedDate from "@components/FormattedDate.astro";
|
||||||
|
|
||||||
const posts = await Astro.glob("./posts/*.md");
|
const posts = await Astro.glob("./posts/*.md");
|
||||||
|
posts.sort(
|
||||||
|
(a, b) =>
|
||||||
|
Date.parse(b.frontmatter.pubDate) - Date.parse(a.frontmatter.pubDate)
|
||||||
|
);
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Blog Archive">
|
<Layout title="Blog Archive">
|
||||||
@@ -10,11 +15,7 @@ const posts = await Astro.glob("./posts/*.md");
|
|||||||
posts.map((post) => (
|
posts.map((post) => (
|
||||||
<div>
|
<div>
|
||||||
<a href={post.url}>{post.frontmatter.title}</a> -{" "}
|
<a href={post.url}>{post.frontmatter.title}</a> -{" "}
|
||||||
{formatInTimeZone(
|
<FormattedDate date={post.frontmatter.pubDate} />
|
||||||
new Date(post.frontmatter.pubDate),
|
|
||||||
"America/New_York",
|
|
||||||
"MMM do, y"
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,15 @@ import Layout from "@layouts/Layout.astro";
|
|||||||
import BlogHeader from "@components/BlogHeader.astro";
|
import BlogHeader from "@components/BlogHeader.astro";
|
||||||
|
|
||||||
const posts = await Astro.glob("./posts/*.md");
|
const posts = await Astro.glob("./posts/*.md");
|
||||||
|
posts.sort(
|
||||||
|
(a, b) =>
|
||||||
|
Date.parse(b.frontmatter.pubDate) - Date.parse(a.frontmatter.pubDate)
|
||||||
|
);
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Home">
|
<Layout title="Home">
|
||||||
{
|
{
|
||||||
posts.map((post) => (
|
posts.slice(0, 5).map((post) => (
|
||||||
<article class="post-preview">
|
<article class="post-preview">
|
||||||
<div>
|
<div>
|
||||||
<BlogHeader
|
<BlogHeader
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: ../../layouts/BlogPost.astro
|
layout: ../../layouts/BlogPost.astro
|
||||||
title: "My Favorite Little Apps"
|
title: "Getting Out of Your Comfort Zone"
|
||||||
pubDate: 2022-11-28
|
pubDate: 2022-12-10
|
||||||
---
|
---
|
||||||
|
|
||||||
When it comes to frameworks, I’ve been firmly stuck in the React–and React-adjacent–world. Basically, my “coding comfort zone” has been vanilla JavaScript, React, and Next.js. The world of web development is much broader than that, but I’m going to be honest, I was a little scared to branch out.
|
When it comes to frameworks, I’ve been firmly stuck in the React–and React-adjacent–world. Basically, my “coding comfort zone” has been vanilla JavaScript, React, and Next.js. The world of web development is much broader than that, but I’m going to be honest, I was a little scared to branch out.
|
||||||
|
|||||||
Reference in New Issue
Block a user