feat: implement tests and coverage reports for KpiCards and scrapeLakes functionality

This commit is contained in:
David Fencl
2026-06-05 23:08:44 +02:00
parent 0030dca448
commit 8193ce818a
37 changed files with 4309 additions and 31 deletions
+6 -2
View File
@@ -16,7 +16,7 @@ interface DataRecord {
}
// Parse date from DD.MM.YYYY HH:MM to ISO
function parseDateString(dateStr: string): string | null {
export function parseDateString(dateStr: string): string | null {
try {
if (!dateStr || !dateStr.includes(' ')) return null;
const [datePart, timePart] = dateStr.trim().split(' ');
@@ -25,8 +25,12 @@ function parseDateString(dateStr: string): string | null {
if (!year || !hours) return null;
const d = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hours), parseInt(minutes));
const y = parseInt(year);
const m = parseInt(month) - 1;
const dDay = parseInt(day);
const d = new Date(y, m, dDay, parseInt(hours), parseInt(minutes));
if (isNaN(d.getTime())) return null;
if (d.getFullYear() !== y || d.getMonth() !== m || d.getDate() !== dDay) return null;
return d.toISOString();
} catch (e) {
return null;