fix(quotes): quote date (تاریخ پیشنهاد) defaults to current time, not midnight

Wizard Step 5 initializes the quote date with the client's current local
time instead of 00:00, and the Jalali datepicker's hour/minute controls
default to the current clock whenever no explicit time is configured
(clicking «امروز» already used the current time). Date-only consumers
are unaffected (times are stripped at the API layer).
This commit is contained in:
2026-09-06 19:03:10 +03:30
parent c5bbbbbaaa
commit 3bdb0027f3
2 changed files with 11 additions and 4 deletions
+9 -2
View File
@@ -39,10 +39,17 @@ function buildIso(jy: number, jm: number, jd: number, h: number, m: number): str
return new Date(gy, gm - 1, gd, h, m).toISOString();
}
// وقتی هنوز زمان مشخصی ست نشده، ساعت/دقیقه‌ی فعلی سیستم پیش‌فرض است
// (نه ۰۰:۰۰) — دکمه‌ی «امروز» و انتخاب روز، همین زمان را نگه می‌دارند.
function nowTime(): { h: number; m: number } {
const d = new Date();
return { h: d.getHours(), m: d.getMinutes() };
}
function timeOf(iso: string | null): { h: number; m: number } {
if (!iso) return { h: 0, m: 0 };
if (!iso) return nowTime();
const d = new Date(iso);
if (Number.isNaN(d.getTime())) return { h: 0, m: 0 };
if (Number.isNaN(d.getTime())) return nowTime();
return { h: d.getHours(), m: d.getMinutes() };
}
+2 -2
View File
@@ -73,8 +73,8 @@ export function WizardPage() {
const [assignment, setAssignment] = useState<Record<string, string[]>>({});
const [quoteDate, setQuoteDate] = useState<string | null>(() => {
const d = new Date();
return new Date(d.getFullYear(), d.getMonth(), d.getDate()).toISOString();
// تاریخ پیشنهاد: همین الان (ساعت و دقیقه‌ی فعلی) — نه نیمه‌شب
return new Date().toISOString();
});
const [expiryDate, setExpiryDate] = useState<string | null>(null);
const [notes, setNotes] = useState("");