Skip to content

Commit f85cb38

Browse files
committed
fix: Safari invalid date issue
1 parent 3f3593e commit f85cb38

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/EventCard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ const EventCard = ({
4242
const formatedDate = new Intl.DateTimeFormat(locale, {
4343
day: "2-digit",
4444
month: "short",
45-
}).formatRange(new Date(startDate), new Date(endDate))
45+
}).formatRange(
46+
// .replace(/-/g, "/") ==> Fixes Safari Invalid date
47+
new Date(startDate?.replace(/-/g, "/")),
48+
new Date(endDate?.replace(/-/g, "/"))
49+
)
4650

4751
return (
4852
<Box

0 commit comments

Comments
 (0)