We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent6367b41 commit6584874Copy full SHA for 6584874
frontend/src/components/Event/EventsCarousel.tsx
@@ -62,11 +62,17 @@ const formatEventDate = (startTime: string, endTime: string): string => {
62
conststartDate=newDate(startTime);
63
constendDate=newDate(endTime);
64
65
-constsameDay=startDate.toDateString()===endDate.toDateString();
+constoptions:Intl.DateTimeFormatOptions={day:'2-digit',month:'2-digit',year:'numeric'};
66
+
67
+constformatDate=(date:Date):string=>{
68
+returnnewIntl.DateTimeFormat('en-AU',options).format(date).replace(/\//g,'/');
69
+};
70
71
+constsameDay=startDate.toDateString()===endDate.toDateString();
72
73
if(sameDay){
-returnstartDate.toLocaleDateString();
74
+returnformatDate(startDate);// Return single date in dd/mm/yyyy
75
}else{
-return`${startDate.toLocaleDateString()} -${endDate.toLocaleDateString()}`;
76
+return`${formatDate(startDate)} -${formatDate(endDate)}`;// Return date range
77
}
-};
78