Type fixes and website fix (#13825)

Various fixes
This commit is contained in:
Félix Malfait
2025-08-11 17:36:53 +02:00
committed by GitHub
parent 68ce13a1be
commit 32cdb66802
10 changed files with 133 additions and 124 deletions
@@ -2,11 +2,15 @@ export const formatGithubPublishedAtDisplayDate = (
dateString: string,
): string => {
const date = new Date(dateString);
if (Number.isNaN(date.getTime())) return '';
const now = new Date();
const isCurrentYear = date.getFullYear() === now.getFullYear();
const formatter = new Intl.DateTimeFormat('en-US', {
month: 'short',
month: isCurrentYear ? 'long' : 'short',
day: 'numeric',
year: 'numeric',
...(isCurrentYear ? {} : { year: 'numeric' }),
});
return formatter.format(date);