news widget
This commit is contained in:
parent
4678ec0cc9
commit
8d416c78d8
@ -56,6 +56,12 @@ export function News() {
|
||||
const formatDate = (dateString: string) => {
|
||||
try {
|
||||
const date = new Date(dateString);
|
||||
|
||||
// Check if date is valid before using formatDistance
|
||||
if (isNaN(date.getTime())) {
|
||||
return dateString; // Return original string if date is invalid
|
||||
}
|
||||
|
||||
return formatDistance(date, new Date(), {
|
||||
addSuffix: true,
|
||||
locale: fr
|
||||
@ -122,7 +128,7 @@ export function News() {
|
||||
<h3 className="text-sm font-medium text-gray-800 line-clamp-2" title={item.title}>
|
||||
{item.title}
|
||||
</h3>
|
||||
<p className="text-xs text-gray-500 line-clamp-2" title={item.description}>
|
||||
<p className="text-xs text-gray-500 line-clamp-2" title={item.description || undefined}>
|
||||
{item.description}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user