Browse Source

chore: date/datetime comparison correction - MySQL

pull/6507/head
Pranav C 1 year ago
parent
commit
e40830954e
  1. 6
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue
  2. 6
      packages/nocodb/src/db/conditionV2.ts

6
packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue

@ -10,11 +10,11 @@ import {
computed, computed,
iconMap, iconMap,
inject, inject,
onMounted,
ref, ref,
useNuxtApp, useNuxtApp,
useViewFilters, useViewFilters,
watch, watch,
onMounted
} from '#imports' } from '#imports'
import type { Filter } from '#imports' import type { Filter } from '#imports'
@ -89,7 +89,7 @@ const addFiltersRowDomRef = ref<HTMLElement>()
const columns = computed(() => meta.value?.columns) const columns = computed(() => meta.value?.columns)
const getColumn = (filter: Filter) => { const getColumn = (filter: Filter) => {
// extract looked up column if available // extract looked up column if available
return btLookupTypesMap.value[filter.fk_column_id] || columns.value?.find((col: ColumnType) => col.id === filter.fk_column_id) return btLookupTypesMap.value[filter.fk_column_id] || columns.value?.find((col: ColumnType) => col.id === filter.fk_column_id)
} }
@ -295,7 +295,7 @@ onMounted(() => {
}) })
onMounted(async () => { onMounted(async () => {
await loadBtLookupTypes() await loadBtLookupTypes()
}) })
</script> </script>

6
packages/nocodb/src/db/conditionV2.ts

@ -460,7 +460,11 @@ const parseConditionV2 = async (
].includes(column.uidt) ].includes(column.uidt)
) { ) {
qb = qb.where(field, val); qb = qb.where(field, val);
} else if (column.ct === 'timestamp' || column.ct === 'date' || column.ct === 'datetime') { } else if (
column.ct === 'timestamp' ||
column.ct === 'date' ||
column.ct === 'datetime'
) {
qb = qb.where(knex.raw('DATE(??) = DATE(?)', [field, val])); qb = qb.where(knex.raw('DATE(??) = DATE(?)', [field, val]));
} else { } else {
// mysql is case-insensitive for strings, turn to case-sensitive // mysql is case-insensitive for strings, turn to case-sensitive

Loading…
Cancel
Save