fix export timezone and calendar month title

- Export now uses time.Now().In(loc) for year/month so users in
  positive UTC offsets get the correct month
- Export month title for Jalali/Hijri now correctly converts the
  first day of the Gregorian month to the target calendar instead
  of using the Gregorian month index to look up target month names
This commit is contained in:
2026-06-24 10:32:17 +03:30
parent 8fe43bff4d
commit 67eae5ffa3
2 changed files with 8 additions and 4 deletions

View File

@@ -79,9 +79,11 @@ func GenerateMonthlyReport(store *db.Store, userID int64, timezone, accent, cale
var monthName string
switch calendar {
case "jalali":
monthName = fmt.Sprintf("%s %d", jalaliMonthNames[month-1], year)
jy, jm, _ := gregorianToJalali(year, int(month), 1)
monthName = fmt.Sprintf("%s %d", jalaliMonthNames[jm-1], jy)
case "hijri":
monthName = fmt.Sprintf("%s %d", hijriMonthNames[month-1], year)
hy, hm, _ := gregorianToHijri(year, int(month), 1)
monthName = fmt.Sprintf("%s %d", hijriMonthNames[hm-1], hy)
default:
monthName = time.Date(year, month, 1, 0, 0, 0, 0, time.UTC).Format("January 2006")
}