display date in user's selected calendar on main menu and reports

buildStatusText and buildDailyReport now use formatDateForCalendar
to convert the stored Gregorian date to the user's calendar type
(jalali/hijri/gregorian).
This commit is contained in:
2026-06-24 10:06:39 +03:30
parent 07306cb0f0
commit 69c5e20d8e
2 changed files with 18 additions and 5 deletions

View File

@@ -276,3 +276,17 @@ func parseGregorianDateKey(key string) (int, int, int) {
fmt.Sscanf(key, "%04d-%02d-%02d", &y, &m, &d)
return y, m, d
}
func formatDateForCalendar(date, calType string) string {
y, m, d := parseGregorianDateKey(date)
switch calType {
case "jalali":
jy, jm, jd := gregorianToJalali(y, m, d)
return fmt.Sprintf("%04d-%02d-%02d", jy, jm, jd)
case "hijri":
hy, hm, hd := gregorianToHijri(y, m, d)
return fmt.Sprintf("%04d-%02d-%02d", hy, hm, hd)
default:
return date
}
}