fix: implement useTranslations for start date on event modal

This commit is contained in:
Luis Felipe Marzagao
2026-04-30 11:08:16 +02:00
committed by Linus Rath
parent a4bb8e0c28
commit f0967f90eb
4 changed files with 159 additions and 108 deletions
+11 -2
View File
@@ -130,6 +130,15 @@ export function EventModal({
const timeFormat = useSettingsStore((s) => s.timeFormat);
const timeDisplayFmt = timeFormat === "12h" ? "h:mm a" : "HH:mm";
const isEdit = !!event;
const formatEventDate = useCallback((startD: Date): string => {
const dayOfWeek = format(startD, "EEE").toLowerCase();
const month = format(startD, "MMM").toLowerCase();
const day = format(startD, "d");
const year = format(startD, "yyyy");
return `${t(`days.${dayOfWeek}`)}, ${t(`months.${month}`)} ${day}, ${year}`;
}, [t]);
const [mode, setMode] = useState<"view" | "edit">(isEdit ? "view" : "edit");
const userIsOrganizer = useMemo(() => {
@@ -517,7 +526,7 @@ export function EventModal({
</div>
<div className="text-sm">
<span className="font-medium">{format(startD, "EEE, MMM d, yyyy")}</span>
<span className="font-medium">{formatEventDate(startD)}</span>
{!event.showWithoutTime && (
<span className="text-muted-foreground ml-2">
{format(startD, timeDisplayFmt)} {format(endD, timeDisplayFmt)}
@@ -638,7 +647,7 @@ export function EventModal({
<Clock className="w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0" />
<div className="text-sm">
<span className="font-medium text-foreground">
{format(startD, "EEE, MMM d, yyyy")}
{formatEventDate(startD)}
</span>
{event.showWithoutTime ? (
<span className="text-muted-foreground ml-1.5">{t("events.all_day")}</span>
+14
View File
@@ -2272,6 +2272,20 @@
"sat": "Sat",
"sun": "Sun"
},
"months": {
"jan": "Jan",
"feb": "Feb",
"mar": "Mar",
"apr": "Apr",
"may": "May",
"jun": "Jun",
"jul": "Jul",
"aug": "Aug",
"sep": "Sep",
"oct": "Oct",
"nov": "Nov",
"dec": "Dez"
},
"notifications": {
"event_created": "Event created",
"event_updated": "Event updated",
+14
View File
@@ -2261,6 +2261,20 @@
"sat": "Sam",
"sun": "Dim"
},
"months": {
"jan": "Jan",
"feb": "Fév",
"mar": "Mar",
"apr": "Avr",
"may": "Mai",
"jun": "Juin",
"jul": "Juil",
"aug": "Aoû",
"sep": "Sep",
"oct": "Oct",
"nov": "Nov",
"dec": "Déc"
},
"notifications": {
"event_created": "Événement créé",
"event_updated": "Événement mis à jour",
+14
View File
@@ -2261,6 +2261,20 @@
"sat": "Sáb",
"sun": "Dom"
},
"months": {
"jan": "Jan",
"feb": "Fev",
"mar": "Mar",
"apr": "Abr",
"may": "Mai",
"jun": "Jun",
"jul": "Jul",
"aug": "Ago",
"sep": "Set",
"oct": "Out",
"nov": "Nov",
"dec": "Dez"
},
"notifications": {
"event_created": "Evento criado",
"event_updated": "Evento atualizado",