Expose visit summary totals for the Statistics dashboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-09-01 11:10:52 +03:30
co-authored by Cursor
parent f42e6fe2a4
commit 6b8073f998
4 changed files with 150 additions and 1 deletions
+15
View File
@@ -19,6 +19,21 @@ export function startOfLocalDay(offsetDays = 0): Date {
return date;
}
/** Start of the current local week. `weekStartsOn`: 0 Sun … 6 Sat. Default Saturday (Iran). */
export function startOfLocalWeek(weekStartsOn = 6): Date {
const today = startOfLocalDay(0);
const diff = (today.getDay() - weekStartsOn + 7) % 7;
return startOfLocalDay(diff);
}
/** First day of the current local month at 00:00:00. */
export function startOfLocalMonth(): Date {
const date = new Date();
date.setDate(1);
date.setHours(0, 0, 0, 0);
return date;
}
function pad2(n: number) {
return String(n).padStart(2, '0');
}