feat: implement tests and coverage reports for KpiCards and scrapeLakes functionality
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user