refactor: enforce semantic values and numeric lint rules

This commit is contained in:
2026-09-13 14:37:25 +03:00
parent 24d332e063
commit 53c852b437
21 changed files with 190 additions and 47 deletions
@@ -7,6 +7,8 @@ import { type IncomeAnalytics, useIncomeAnalytics } from "@/entities/income";
import { validationMessage } from "@/shared/i18n";
import { formatDate } from "@/shared/lib";
const ISO_MONTH_LENGTH = 7;
type IncomePeriod = { from: string; to: string };
type IncomeForm = IncomePeriod;
@@ -143,7 +145,7 @@ function draftPeriod(period: IncomePeriod): IncomeForm {
function defaultPeriod(): IncomePeriod {
const today = moscowDate(new Date());
return { from: `${today.slice(0, 7)}-01`, to: today };
return { from: `${today.slice(0, ISO_MONTH_LENGTH)}-01`, to: today };
}
function validPeriod(period: IncomePeriod): period is IncomePeriod {