Skip to content

fix(changelog): Fix hydration error #10993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading