Commit Graph

5 Commits

Author SHA1 Message Date
f89f5607aa fix: calendar day-of-week offset off by one, nav double-jump, race conditions
- Fix Jalali/Gregorian/Hijri day-of-week startOffset formulas
  (dow returns 0=Sat, not 0=Sun as the old comment claimed)
- Fix calendar and export month picker navigation jumping 2 months
  (navMonth buttons already have pre-computed values; handlers
  were decrementing/incrementing them again)
- Fix GetOrCreateUser/GetOrCreateDay race condition with INSERT OR IGNORE
- Add month/day bounds validation in handleEditMsg to prevent panic
2026-06-24 11:07:53 +03:30
577aee91fb refactor: remove dead code, DRY calendar navigation and helpers
- Fix Jalali calendar weekday offset in buildCalendarMonth
- Remove unused gregorianDateKey function and PairCount field
- Replace inline export month title with formatMonthTitle
- Extract navMonth helper for prev/next month navigation
- Extract sendOrEdit helper for send-vs-edit message pattern
- Extract monthGregorianRange helper to simplify editCalendar 3-way switch
- Replace export displayDate conversion with formatDateForCalendar
2026-06-24 10:54:06 +03:30
69c5e20d8e 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).
2026-06-24 10:06:39 +03:30
b900710196 fix: correct Jalali calendar year conversion
Complete rewrite of gregorianToJalali and jalaliToGregorian using
proper JDN arithmetic. Removed broken epoch offset (226899 / year 979)
and replaced with jalaliEpochJDN = 1948320 (March 21, 622 CE).

Verified: 2026-06-24 -> Jalali 1405-04-03 (correct)
Nowruz 1405 verified as 2026-03-21
2026-06-24 09:48:39 +03:30
9d123316e6 feat: Hijri calendar, virtual midnight crossover, overlap rejection, WAL mode
- Hijri (قمری) calendar added as 3rd calendar option with tabular conversion
- Calendar type select menu (like accent) with gregorian/jalali/hijri
- Calendar type applied to exports and reports
- Midnight crossover: virtual splits at computation time (no synthetic DB events)
  - Handles both UTC and local timezone boundaries
  - Timezone changes handled naturally (recomputed on-the-fly)
- Rate limiting per user ID instead of chat ID
- WAL mode enabled for SQLite
- Smart reply keyboard updates after every state change
- Overlapping time edits rejected (must preserve in/out alternation)
- Single event deletion warns if timeline needs repair
- Day off no longer prevents clock in/out
- Accent colors shown with descriptive names in select menu
- Delete button label changed to DEL for visual distinction
2026-06-24 09:39:15 +03:30