fix: resolve calendar crash and enhance appointment management

- Fixed calendar crash due to invalid array length in PersianCalendar.tsx by changing locale to 'en-u-ca-persian'.
- Added Persian weekday display in DateNavigator with appropriate styling and logic.
- Updated empty slot message to indicate when a day is off.
- Made patient name a required field in appointment creation and implemented find-or-create logic for patients in both admin and user endpoints.
- Corrected mobile number display to show the patient's number instead of the doctor's in appointment listings.
- Ensured booked appointments are displayed correctly in the schedule view.
- Removed unnecessary operations column from the appointments table view.
This commit is contained in:
hamed
2026-06-11 19:35:12 +03:30
parent 277922d4ae
commit 0b31eb7812
7 changed files with 631 additions and 63 deletions
@@ -12,8 +12,8 @@ const WEEK_DAYS = ['ش', 'ی', 'د', 'س', 'چ', 'پ', 'ج'];
const pf = new Intl.DateTimeFormat('fa-IR-u-ca-persian', { calendar: 'persian' });
function toJalali(d: Date): { year: number; month: number; day: number } {
const parts = new Intl.DateTimeFormat('fa-IR-u-ca-persian', {
year: 'numeric', month: 'numeric', day: 'numeric', calendar: 'persian',
const parts = new Intl.DateTimeFormat('en-u-ca-persian', {
year: 'numeric', month: 'numeric', day: 'numeric',
}).formatToParts(d);
const get = (t: string) => parseInt(parts.find(p => p.type === t)?.value ?? '0', 10);
return { year: get('year'), month: get('month'), day: get('day') };