fix(i18n): preserve local calendar day in job date pickers
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user