From 107c9e2dfc62e54f4c3e08d17e578cf351ff1cf0 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 3 May 2022 14:11:06 +0100 Subject: [PATCH] Fix for #5553 - when importing for SQL databases attempt to manage date and time only column times, handle these when displaying in tables and when filtering. --- .../bbui/src/Table/DateTimeRenderer.svelte | 13 +++++++++---- .../backend/DataTable/RowFieldControl.svelte | 9 +++++++-- .../FilterEditor/FilterDrawer.svelte | 11 ++++++++++- .../app/dynamic-filter/FilterModal.svelte | 11 ++++++++++- .../src/integrations/microsoftSqlServer.ts | 4 +--- packages/server/src/integrations/mysql.ts | 3 ++- packages/server/src/integrations/oracle.ts | 6 +++--- packages/server/src/integrations/postgres.ts | 3 +-- packages/server/src/integrations/utils.ts | 17 ++++++++++++++--- packages/server/yarn.lock | 18 +++++++++--------- packages/worker/yarn.lock | 18 +++++++++--------- 11 files changed, 75 insertions(+), 38 deletions(-) diff --git a/packages/bbui/src/Table/DateTimeRenderer.svelte b/packages/bbui/src/Table/DateTimeRenderer.svelte index 5d856968e7..f4b0821069 100644 --- a/packages/bbui/src/Table/DateTimeRenderer.svelte +++ b/packages/bbui/src/Table/DateTimeRenderer.svelte @@ -2,17 +2,22 @@ import dayjs from "dayjs" export let value + export let schema // adding the 0- will turn a string like 00:00:00 into a valid ISO // date, but will make actual ISO dates invalid $: time = new Date(`0-${value}`) - $: isTime = !isNaN(time) + $: isTimeOnly = !isNaN(time) || schema?.timeOnly + $: isDateOnly = schema?.dateOnly + $: format = isTimeOnly + ? "HH:mm:ss" + : isDateOnly + ? "MMMM D YYYY" + : "MMMM D YYYY, HH:mm"
- {dayjs(isTime ? time : value).format( - isTime ? "HH:mm:ss" : "MMMM D YYYY, HH:mm" - )} + {dayjs(isTimeOnly ? time : value).format(format)}