Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { useMemo } from 'react';
import { Box, Typography } from '@mui/material';
import { DesktopDateTimePicker, LocalizationProvider } from '@mui/x-date-pickers';
import dayjs, { Dayjs } from 'dayjs';
Expand All @@ -19,6 +20,8 @@ export const DateField: React.FC<DateFieldProps> = props => {
const { title, description, minDate, id } = props;
const field = useFieldContext<string>();

const dateValue = useMemo(() => dayjs(field.state.value), [field.state.value]);

return (
<Box>
{title && (
Expand All @@ -35,7 +38,7 @@ export const DateField: React.FC<DateFieldProps> = props => {

<LocalizationProvider dateAdapter={AdapterDayjs}>
<DesktopDateTimePicker
value={dayjs(field.state.value)}
value={dateValue}
format={dateTimeFormatISO}
minDateTime={minDate || dayjs()}
ampm={false}
Expand Down
Loading