fix(i18n): preserve local calendar day in job date pickers

This commit is contained in:
cesnimda
2026-11-11 07:42:27 +01:00
parent df93bfb64e
commit 265794e010
13 changed files with 436 additions and 4 deletions
@@ -1,6 +1,7 @@
import React, { useEffect, useMemo, useRef, useState } from "react";
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import { format, parseISO } from "date-fns";
import {
Alert,
@@ -78,13 +79,13 @@ function getTodayIso() {
function parsePickerDate(value?: string | null): Date | null {
if (!value) return null;
const parsed = new Date(value);
const parsed = /^\d{4}-\d{2}-\d{2}$/.test(value) ? parseISO(value) : new Date(value);
return Number.isNaN(+parsed) ? null : parsed;
}
function toPickerIso(value: Date | null) {
if (!value || Number.isNaN(+value)) return "";
return value.toISOString().slice(0, 10);
return format(value, "yyyy-MM-dd");
}
function emptyAttachmentBuckets(): AttachmentBuckets {