Skip to content

Commit

Permalink
fix(changelog): Fix hydration error (#10993)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst authored Aug 6, 2024
1 parent 64ae970 commit dcf71f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions apps/changelog/src/client/components/article.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {ReactNode} from 'react';

import Date from './date';
import Tag from './tag';
import { DateComponent } from './date';

type ArticleProps = {
children?: ReactNode;
Expand Down Expand Up @@ -48,7 +47,7 @@ export default function Article({
<div className="prose max-w-none text-gray-700 py-2">{children}</div>
<dl>
<dd className="text-xs leading-6 text-gray-400">
{date && <Date date={date} />}
{date && <DateComponent date={date} />}
</dd>
</dl>
</div>
Expand Down
5 changes: 2 additions & 3 deletions apps/changelog/src/client/components/date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ const formatDate = (date: string | Date) => {
year: 'numeric',
month: 'long',
day: 'numeric',
timeZone: 'UTC'
};
const now = new Date(date).toLocaleDateString('en-EN', options);

return now;
};

function DateComponent({date}: {date: string | Date}) {
export function DateComponent({date}: {date: string | Date}) {
return <time dateTime={formatDate(date)}>{formatDate(date)}</time>;
}

export default DateComponent;

0 comments on commit dcf71f3

Please sign in to comment.