From 8be590ea897dff7004f4c90e01948727dbc1e831 Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Fri, 13 Jan 2023 15:44:29 -0500 Subject: [PATCH] fix: handle date/time only when display format not provided (#347) --- .github/workflows/build.yml | 2 ++ packages/core/dev-test/config.yml | 2 +- packages/core/src/widgets/datetime/DateTimeControl.tsx | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 884d1b2b..16079fda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,6 +30,8 @@ jobs: yarn install --frozen-lockfile - name: Build + env: + NODE_OPTIONS: "--max-old-space-size=8192" run: | yarn build diff --git a/packages/core/dev-test/config.yml b/packages/core/dev-test/config.yml index a74e1cbb..bfbeb9c1 100644 --- a/packages/core/dev-test/config.yml +++ b/packages/core/dev-test/config.yml @@ -217,7 +217,7 @@ collections: label: Date widget: datetime format: 'MMM d, yyyy' - date_format: 'MMM d, yyyy' + time_format: false required: false - name: date_with_default label: Date With Deafult diff --git a/packages/core/src/widgets/datetime/DateTimeControl.tsx b/packages/core/src/widgets/datetime/DateTimeControl.tsx index e3c0fef4..f647874c 100644 --- a/packages/core/src/widgets/datetime/DateTimeControl.tsx +++ b/packages/core/src/widgets/datetime/DateTimeControl.tsx @@ -98,6 +98,14 @@ const DateTimeControl: FC> = ({ } } + if (timeFormat === false) { + return 'yyyy-MM-dd'; + } + + if (dateFormat === false) { + return 'HH:mm:ss.SSSXXX'; + } + return "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; }, [dateFormat, timeFormat]);