Fix live test follow-up issues

This commit is contained in:
t.indorf
2026-05-19 14:28:32 +02:00
parent 3fa3b9b108
commit 99ff978116
9 changed files with 79 additions and 24 deletions
+6 -4
View File
@@ -4,7 +4,7 @@ import { Info, Calendar, ArrowRight, ShieldAlert } from "lucide-react";
import { requireRole } from "@/lib/auth-utils";
import { prisma } from "@/lib/prisma";
import { getTargetMonthData } from "@/lib/date-utils";
import { formatDateKey, getTargetMonthData } from "@/lib/date-utils";
import { Button } from "@/components/ui/button";
import { NotdienstEntry } from "./notdienst-entry";
@@ -45,6 +45,8 @@ export default async function NotdienstPage() {
const targetData = getTargetMonthData();
const { targetYear, targetMonth, monthName, isLocked } = targetData;
const targetMonthStart = new Date(Date.UTC(targetYear, targetMonth - 1, 1));
const targetMonthEnd = new Date(Date.UTC(targetYear, targetMonth, 1));
const requiredDaysTotal = children.length * kita.notdienstMinPerChildPerMonth;
const childIds = children.map((child) => child.id);
@@ -58,8 +60,8 @@ export default async function NotdienstPage() {
kitaId,
childId: { in: childIds },
date: {
gte: new Date(targetYear, targetMonth - 1, 1),
lt: new Date(targetYear, targetMonth, 1),
gte: targetMonthStart,
lt: targetMonthEnd,
},
},
select: { date: true },
@@ -77,7 +79,7 @@ export default async function NotdienstPage() {
])
: [[], 0];
const selectedDates = availabilities.map((a) => a.date.toISOString());
const selectedDates = availabilities.map((a) => formatDateKey(a.date));
return (
<div className="mx-auto max-w-4xl px-4 py-8 sm:px-8">