From ceecc20f87b871989f439b6a8bb3863b1a1608d6 Mon Sep 17 00:00:00 2001 From: Rafael Solorzano <61289255+rafasdc@users.noreply.github.com> Date: Thu, 23 May 2024 09:09:05 -0700 Subject: [PATCH] chore: extend date default widget to not show time --- app/components/Review/ReviewTheme.tsx | 2 ++ app/components/Review/widgets/DateWidget.tsx | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 app/components/Review/widgets/DateWidget.tsx diff --git a/app/components/Review/ReviewTheme.tsx b/app/components/Review/ReviewTheme.tsx index d4fdc7b6d9..8cc5befb9e 100644 --- a/app/components/Review/ReviewTheme.tsx +++ b/app/components/Review/ReviewTheme.tsx @@ -10,6 +10,7 @@ import DefaultWidget from './widgets/DefaultWidget'; import MoneyWidget from './widgets/MoneyWidget'; import BooleanWidget from './widgets/BooleanWidget'; import FileWidget from './widgets/FileWidget'; +import DateWidget from './widgets/DateWidget'; const { templates } = getDefaultRegistry(); @@ -36,6 +37,7 @@ const ReviewTheme: ThemeProps = { ReadOnlyWidget: DefaultWidget, ReadOnlyProjectAreaWidget: DefaultWidget, ReadOnlyProjectAreaWidgetIntakeFour: DefaultWidget, + DateWidget, }, templates: { ...templates, diff --git a/app/components/Review/widgets/DateWidget.tsx b/app/components/Review/widgets/DateWidget.tsx new file mode 100644 index 0000000000..3022897120 --- /dev/null +++ b/app/components/Review/widgets/DateWidget.tsx @@ -0,0 +1,8 @@ +import { WidgetProps } from '@rjsf/utils'; + +const DateWidget: React.FC = ({ value }) => { + const date = value?.toString().split('T')[0]; + return <>{date}; +}; + +export default DateWidget;