Remove date helper function
Some checks failed
Build And Publish / BuildAndPublish (push) Failing after 2m12s

This commit is contained in:
Ryan Freeman 2025-03-29 10:46:57 +00:00
parent 907da404b2
commit 25a92b4f4c
4 changed files with 6 additions and 13 deletions

View File

@ -7,6 +7,7 @@ import {formatDate} from '@/lib/formatDate'
import type {Article} from '@/types'
import {metadata as _metadata} from '@/lib/generateMetadata'
import {SimpleLayout} from '@/components/layouts/SimpleLayout'
import {format} from 'date-fns'
const meta = {
title: 'Ryan Freeman - Full-stack software engineer based in Dublin, Ireland.',
@ -45,7 +46,7 @@ function Article(article: Article) {
</Card.Title>
<p className="flex order-first space-x-1 z-10 mb-3">
<Card.Eyebrow as="time" dateTime={article.date} decorate={false}>
{formatDate(article.date)}
{format(article.date, 'do MMMM yyyy')}
</Card.Eyebrow>
<Views
slug={article.slug}

View File

@ -2,10 +2,10 @@ import React from 'react'
import {SimpleLayout} from '@/components/layouts/SimpleLayout'
import {Card} from '@/components/ui/Card'
import {Views} from '@/components/ui/Views'
import {formatDate} from '@/lib/formatDate'
import {getAllArticles} from '@/lib/getAllArticles'
import {metadata as _metadata} from '@/lib/generateMetadata'
import type {Article} from '@/types'
import {format} from 'date-fns'
const meta = {
title: 'Writing',
@ -42,7 +42,7 @@ function Article({article}: { article: Article }) {
</Card.Title>
<p className="flex order-first space-x-1 z-10 mb-3 md:mb-0 md:ml-4 md:order-last flex-shrink-0">
<Card.Eyebrow as="time" dateTime={article.date} decorate={false}>
{formatDate(article.date)}
{format(article.date, 'do MMMM yyyy')}
</Card.Eyebrow>
<Views
slug={article.slug}

View File

@ -4,11 +4,11 @@ import {Container} from '@/components/common/Container'
import {Prose} from '@/components/ui/Prose'
import {Views} from '@/components/ui/Views'
import {ArrowDownIcon} from '@/components/icons/ArrowDownIcon'
import {formatDate} from '@/lib/formatDate'
import ArticleNav from '@/components/ui/ArticleNav'
import Comments from '@/components/ui/Comments'
import {getAllArticles} from '@/lib/getAllArticles'
import {getComments} from '@/lib/getComments'
import {format} from 'date-fns'
type ArticleLayout = {
title: string
@ -76,7 +76,7 @@ export async function ArticleLayout({
</h1>
<p className="order-first text-base text-zinc-500 dark:text-zinc-400">
<time dateTime={date}>
<span>{formatDate(date)}</span>
<span>{format(date, 'do MMMM yyyy')}</span>
</time>
<Views slug={slug} title={title} shouldUpdateViews={true}/>
</p>

View File

@ -1,8 +0,0 @@
export function formatDate(dateString: string) {
return new Date(`${dateString}`).toLocaleDateString('en-IE', {
day: 'numeric',
month: 'long',
year: 'numeric',
timeZone: 'UTC'
})
}