Skip to content

Commit dcf71f3

Browse files
author
Luca Forstner
authored
fix(changelog): Fix hydration error (#10993)
1 parent 64ae970 commit dcf71f3

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

apps/changelog/src/client/components/article.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {ReactNode} from 'react';
2-
3-
import Date from './date';
42
import Tag from './tag';
3+
import { DateComponent } from './date';
54

65
type ArticleProps = {
76
children?: ReactNode;
@@ -48,7 +47,7 @@ export default function Article({
4847
<div className="prose max-w-none text-gray-700 py-2">{children}</div>
4948
<dl>
5049
<dd className="text-xs leading-6 text-gray-400">
51-
{date && <Date date={date} />}
50+
{date && <DateComponent date={date} />}
5251
</dd>
5352
</dl>
5453
</div>

apps/changelog/src/client/components/date.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ const formatDate = (date: string | Date) => {
33
year: 'numeric',
44
month: 'long',
55
day: 'numeric',
6+
timeZone: 'UTC'
67
};
78
const now = new Date(date).toLocaleDateString('en-EN', options);
89

910
return now;
1011
};
1112

12-
function DateComponent({date}: {date: string | Date}) {
13+
export function DateComponent({date}: {date: string | Date}) {
1314
return <time dateTime={formatDate(date)}>{formatDate(date)}</time>;
1415
}
15-
16-
export default DateComponent;

0 commit comments

Comments
 (0)