feat(cards): refine controls and modal transitions

This commit is contained in:
2026-09-12 22:34:27 +03:00
parent cf21a5bd17
commit aba4cf1ce8
16 changed files with 245 additions and 107 deletions
+23
View File
@@ -0,0 +1,23 @@
import dayjs from "dayjs";
import { z } from "zod";
import { bankMonth } from "./form-validation";
const calendarDate = z.string().date();
function bankPeriod(params: URLSearchParams) {
const month = bankMonth(params.get("month"));
const from = params.get("from");
const to = params.get("to");
return from &&
to &&
calendarDate.safeParse(from).success &&
calendarDate.safeParse(to).success &&
from >= "0001-01-01" &&
from <= to
? { from, to }
: {
from: `${month}-01`,
to: dayjs(`${month}-01`).endOf("month").format("YYYY-MM-DD"),
};
}
export { bankPeriod };