diff --git a/package-lock.json b/package-lock.json index 7a060ed91..163287afa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,6 @@ "simple-functional-loader": "^1.2.1", "stringify-object": "^3.3.0", "tailwindcss": "^3.4.3", - "tinytime": "^0.2.6", "unified": "^10.1.2", "unist-util-filter": "^4.0.1", "unist-util-visit": "^4.1.2", @@ -10232,10 +10231,6 @@ "dev": true, "license": "MIT" }, - "node_modules/tinytime": { - "version": "0.2.6", - "license": "MIT" - }, "node_modules/tmp": { "version": "0.0.33", "dev": true, diff --git a/package.json b/package.json index 057efa9de..53bd56f07 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,6 @@ "simple-functional-loader": "^1.2.1", "stringify-object": "^3.3.0", "tailwindcss": "^3.4.3", - "tinytime": "^0.2.6", "unified": "^10.1.2", "unist-util-filter": "^4.0.1", "unist-util-visit": "^4.1.2", diff --git a/src/components/PostItem.js b/src/components/PostItem.js index 39ff0e629..f5a15d60a 100644 --- a/src/components/PostItem.js +++ b/src/components/PostItem.js @@ -3,6 +3,12 @@ import clsx from 'clsx' import { Button } from '@/components/Button' import { formatDate } from '@/utils/formatDate' +const dateFormat = { + month: 'long', + day: 'numeric', + year: 'numeric', +} + export default function PostItem({ title, category, slug, date, children, wide = false }) { return (
- + @@ -50,7 +57,7 @@ export function BlogPostLayout({ children, meta }) { className={clsx('absolute top-0 inset-x-0 text-slate-700 dark:text-slate-400')} > diff --git a/src/layouts/JobPostingLayout.js b/src/layouts/JobPostingLayout.js index c8f6e5f3c..ee03680f9 100644 --- a/src/layouts/JobPostingLayout.js +++ b/src/layouts/JobPostingLayout.js @@ -7,6 +7,14 @@ import { mdxComponents } from '@/utils/mdxComponents' import { MDXProvider } from '@mdx-js/react' import Link from 'next/link' +const dateFormat = { + month: 'long', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + year: 'numeric' +} + function BackgroundBeams() { return (
@@ -203,7 +211,7 @@ export function JobPostingLayout({ children, meta }) {

Closes on{' '}

diff --git a/src/pages/blog/index.js b/src/pages/blog/index.js index f48d000eb..fb4f52b15 100644 --- a/src/pages/blog/index.js +++ b/src/pages/blog/index.js @@ -7,6 +7,12 @@ import { formatDate } from '@/utils/formatDate' import buildRss from '@/scripts/build-rss' import { renderToStaticMarkup } from 'react-dom/server' +const dateFormat = { + month: 'long', + day: 'numeric', + year: 'numeric', +} + export default function Blog({ posts }) { return (
@@ -52,7 +58,7 @@ export default function Blog({ posts }) {
Date
- +
diff --git a/src/utils/formatDate.js b/src/utils/formatDate.js index 18ea750e4..03d001413 100644 --- a/src/utils/formatDate.js +++ b/src/utils/formatDate.js @@ -1,7 +1,14 @@ -import tinytime from 'tinytime' +export function formatDate(dateString, options) { + const date = new Date(dateString); + const defaultTimeZoneOptions = options?.hour + ? { + timeZoneName: 'shortGeneric', + timeZone: 'America/New_York', + } + : {}; -export function formatDate(date, format) { - return tinytime(format) - .render(typeof date === 'string' ? new Date(date) : date) - .replace('Febuary', 'February') + return new Intl.DateTimeFormat("en-US", { + ...defaultTimeZoneOptions, + ...options, + }).format(date); }