feat(frontend): redesign race dashboard
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
This commit is contained in:
@@ -2,16 +2,20 @@ import type { Race } from "../api";
|
||||
|
||||
export const WEEKDAY_LABELS_SHORT_RU: string[] = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"];
|
||||
|
||||
/** Monday-based week: Mon=0 … Sun=6 */
|
||||
/** Monday-based week: Mon=0 ... Sun=6 */
|
||||
function mondayIndexFromJsDay(jsDay: number): number {
|
||||
return (jsDay + 6) % 7;
|
||||
}
|
||||
|
||||
/** Monday-based week: Mon=0 ... Sun=6 */
|
||||
export function mondayIndexFromDate(d: Date): number {
|
||||
return (d.getDay() + 6) % 7;
|
||||
return mondayIndexFromJsDay(d.getDay());
|
||||
}
|
||||
|
||||
/** Grid cells for one month: `null` = empty, `1..31` = day of month. Padded to full weeks, at least 6 rows. */
|
||||
export function buildMonthCells(year: number, monthIndex: number): (number | null)[] {
|
||||
const first = new Date(year, monthIndex, 1);
|
||||
const lead = mondayIndexFromDate(first);
|
||||
const dim = new Date(year, monthIndex + 1, 0).getDate();
|
||||
const lead = mondayIndexFromJsDay(new Date(Date.UTC(year, monthIndex, 1)).getUTCDay());
|
||||
const dim = new Date(Date.UTC(year, monthIndex + 1, 0)).getUTCDate();
|
||||
const cells: (number | null)[] = [];
|
||||
for (let i = 0; i < lead; i += 1) {
|
||||
cells.push(null);
|
||||
|
||||
Reference in New Issue
Block a user