diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-12-12 18:40:12 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-12-12 18:40:12 +0100 |
| commit | c3363ee0e3808d826c4e4797ffa7207647435e08 (patch) | |
| tree | 9797a7d9e91bedc229df48635d5d45cf5cb632bc /src/frontend/app/routes/planner.tsx | |
| parent | ffb8ee87898bffe5fee706abb047133585bb5d0d (diff) | |
feat: add comfort parameters to AppConfiguration and update OTP service for Madrid timezone handling
Diffstat (limited to 'src/frontend/app/routes/planner.tsx')
| -rw-r--r-- | src/frontend/app/routes/planner.tsx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/frontend/app/routes/planner.tsx b/src/frontend/app/routes/planner.tsx index 0f52fef..5121dce 100644 --- a/src/frontend/app/routes/planner.tsx +++ b/src/frontend/app/routes/planner.tsx @@ -104,10 +104,12 @@ const ItinerarySummary = ({ const startTime = new Date(itinerary.startTime).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", + timeZone: "Europe/Madrid", }); const endTime = new Date(itinerary.endTime).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", + timeZone: "Europe/Madrid", }); const walkTotals = sumWalkMetrics(itinerary.legs); @@ -121,15 +123,6 @@ const ItinerarySummary = ({ itinerary.cardFareEuro ?? busLegsCount * FARE_CARD_PER_BUS ).toFixed(2); - // Format currency based on locale (ES/GL: "1,50 €", EN: "€1.50") - const formatCurrency = (amount: string) => { - const isSpanishOrGalician = - i18n.language.startsWith("es") || i18n.language.startsWith("gl"); - return isSpanishOrGalician - ? t("planner.cash_fare", { amount }) - : t("planner.cash_fare", { amount }); - }; - return ( <div className="bg-white dark:bg-slate-800 p-4 rounded-lg shadow mb-3 cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-700 border border-gray-200 dark:border-slate-700" @@ -193,11 +186,15 @@ const ItinerarySummary = ({ <span className="flex items-center gap-3"> <span className="flex items-center gap-1 font-semibold text-slate-700 dark:text-slate-300"> <Coins className="w-4 h-4" /> - {formatCurrency(cashFare)} + {cashFare === "0.00" + ? t("planner.free") + : t("planner.fare", { amount: cashFare })} </span> <span className="flex items-center gap-1 text-slate-600 dark:text-slate-400"> <CreditCard className="w-4 h-4" /> - {t("planner.card_fare", { amount: cardFare })} + {cardFare === "0.00" + ? t("planner.free") + : t("planner.fare", { amount: cardFare })} </span> </span> </div> @@ -628,6 +625,7 @@ const ItineraryDetail = ({ {new Date(leg.startTime).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", + timeZone: "Europe/Madrid", })}{" "} -{" "} {( @@ -812,6 +810,7 @@ export default function PlannerPage() { ? new Date(searchTime).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", + timeZone: "Europe/Madrid", }) : null; |
