Expose visit summary totals for the Statistics dashboard.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
f42e6fe2a4
commit
6b8073f998
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user