Fix updated dates formatting
This commit is contained in:
@@ -14,7 +14,7 @@ const {
|
|||||||
} = Astro.props;
|
} = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<html>
|
<html lang="en-us">
|
||||||
<BaseHead title={title} description={description} />
|
<BaseHead title={title} description={description} />
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -23,13 +23,10 @@ const {
|
|||||||
<article>
|
<article>
|
||||||
{heroImage && <img width={720} height={360} src={heroImage} alt="" />}
|
{heroImage && <img width={720} height={360} src={heroImage} alt="" />}
|
||||||
<h1 class="article-title">{title}</h1>
|
<h1 class="article-title">{title}</h1>
|
||||||
{added && <time>{added}</time>}
|
{updated ?
|
||||||
{
|
<span><time>{added}</time>, last updated on <time>{updated}</time></span>
|
||||||
updated && (
|
:
|
||||||
<div>
|
<span>{added && <time>{added}</time>}</span>
|
||||||
Last updated on <time>{updated}</time>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
<hr />
|
<hr />
|
||||||
<div class="blog-post">
|
<div class="blog-post">
|
||||||
|
|||||||
@@ -22,6 +22,19 @@ post.frontmatter.added = new Date(post.frontmatter.added).toLocaleDateString(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (post.frontmatter.updated === "Invalid Date") {
|
||||||
|
post.frontmatter.updated = null;
|
||||||
|
} else {
|
||||||
|
post.frontmatter.updated = new Date(post.frontmatter.updated).toLocaleDateString(
|
||||||
|
"en-us",
|
||||||
|
{
|
||||||
|
year: "numeric",
|
||||||
|
month: "short",
|
||||||
|
day: "numeric",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Content,
|
Content,
|
||||||
frontmatter: { title, added, updated, tags, excerpt },
|
frontmatter: { title, added, updated, tags, excerpt },
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ nav {
|
|||||||
top: 0;
|
top: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: var(--transwhite);
|
background: var(--transwhite);
|
||||||
|
-webkit-backdrop-filter: blur(1px);
|
||||||
backdrop-filter: blur(1px);
|
backdrop-filter: blur(1px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user