From 43b10f91c05818ad244f64284aef6b83b0319214 Mon Sep 17 00:00:00 2001
From: Luca <102960244+Luca-Timo@users.noreply.github.com>
Date: Sat, 6 Jun 2026 02:22:46 +0200
Subject: [PATCH] fix(crm): localize scheduled-send + installment date +
timezone picker
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From dev testing:
- BillEditor 'Geplanter Versand' was a native →
rendered US date + 12h regardless of settings. Split into LocalizedDateInput
+ TimeField (honour general_date_format + general_time_format), recombined
into the YYYY-MM-DDTHH:MM the payload/scheduler expect.
- InstallmentsPanel 'Send on' native (browser-locale via a
lang hint, wrong in Safari/Firefox) → LocalizedDateInput, consistent in every
browser. (Luca approved converting it.)
- Business-profile Timezone was a free-text input → dropdown of the full IANA
list (Intl.supportedValuesOf, CH/LI fallback), blank = system default.
---
.../components/admin/InstallmentsPanel.tsx | 11 ++---
.../src/pages/admin/bills/BillEditorPage.tsx | 27 +++++++++++-
.../settings/SettingsBusinessProfilePage.tsx | 43 ++++++++++++++-----
3 files changed, 60 insertions(+), 21 deletions(-)
diff --git a/frontend/src/components/admin/InstallmentsPanel.tsx b/frontend/src/components/admin/InstallmentsPanel.tsx
index 39c2c8af..e735274c 100644
--- a/frontend/src/components/admin/InstallmentsPanel.tsx
+++ b/frontend/src/components/admin/InstallmentsPanel.tsx
@@ -26,10 +26,9 @@
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { Trash2, Plus } from 'lucide-react';
-import { Button, Input } from '../common';
+import { Button, Input, LocalizedDateInput } from '../common';
import type { PaymentTermInstallment } from '../../services/quotes.service';
import { useInstallmentDefaults } from '../../hooks/useInstallmentDefaults';
-import { useLocalizedDate } from '../../hooks/useLocalizedDate';
export type InstallmentPlan = PaymentTermInstallment[];
@@ -69,7 +68,6 @@ export const InstallmentsPanel: React.FC = ({
value, onChange, onValidityChange, eventDate, disabled,
}) => {
const { t } = useTranslation();
- const { dateInputLang } = useLocalizedDate();
const defaults = useInstallmentDefaults();
const [advanced, setAdvanced] = React.useState(false);
@@ -230,12 +228,9 @@ export const InstallmentsPanel: React.FC = ({
'On delivery — admin releases manually. Switch to advanced to change.')}
) : (
- {
- const next = e.target.value;
+ onChange={(next) => {
if (!next) return;
const offset = daysBetween(todayIso(), next);
update(idx, { trigger: 'fixed_date', offset_days: offset });
diff --git a/frontend/src/pages/admin/bills/BillEditorPage.tsx b/frontend/src/pages/admin/bills/BillEditorPage.tsx
index 81cfd8d3..228f5281 100644
--- a/frontend/src/pages/admin/bills/BillEditorPage.tsx
+++ b/frontend/src/pages/admin/bills/BillEditorPage.tsx
@@ -566,8 +566,31 @@ export const BillEditorPage: React.FC = () => {
: t('bills.field.dueDateOverrideOff', 'Auto from send date + payment term — tick to set manually')}
- setScheduledSendAt(e.target.value)} />
+
+
+ {/* Localized date + time (honours general_date_format +
+ general_time_format) instead of a native datetime-local, which
+ renders in the browser locale (US date + 12h). Recombined into
+ the "YYYY-MM-DDTHH:MM" the payload + scheduler expect. */}
+