mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
treat filter datetime inputs as local; convert to UTC on apply
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import { TagList } from '.';
|
||||
import { toLocalDateTimeISO } from '$lib/helpers/date';
|
||||
import { Icon, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
@@ -79,7 +80,7 @@
|
||||
value = column?.array ? [] : null;
|
||||
if (column?.type === 'datetime') {
|
||||
const now = new Date();
|
||||
value = now.toISOString().slice(0, 16);
|
||||
value = toLocalDateTimeISO(now.toISOString()).slice(0, 16);
|
||||
}
|
||||
// Initialize spatial data with default values
|
||||
if (column?.type === 'point') {
|
||||
@@ -108,7 +109,11 @@
|
||||
if (isDistanceOperator && distanceValue !== null && value !== null) {
|
||||
addFilter(columnsArray, columnId, operatorKey, value, arrayValues, distanceValue);
|
||||
} else {
|
||||
addFilter(columnsArray, columnId, operatorKey, value, arrayValues);
|
||||
const preparedValue =
|
||||
column?.type === 'datetime' && typeof value === 'string' && value
|
||||
? new Date(value).toISOString()
|
||||
: value;
|
||||
addFilter(columnsArray, columnId, operatorKey, preparedValue, arrayValues);
|
||||
}
|
||||
|
||||
columnId = null;
|
||||
|
||||
@@ -57,7 +57,11 @@
|
||||
}
|
||||
|
||||
function addCondition() {
|
||||
const newTag = generateTag(selectedColumn, operatorKey, value || arrayValues);
|
||||
const preparedValue =
|
||||
column?.type === 'datetime' && typeof value === 'string' && value
|
||||
? new Date(value).toISOString()
|
||||
: value;
|
||||
const newTag = generateTag(selectedColumn, operatorKey, preparedValue || arrayValues);
|
||||
if (localTags.some((t) => t.tag === newTag.tag && t.value === newTag.value)) {
|
||||
return;
|
||||
} else {
|
||||
@@ -66,7 +70,7 @@
|
||||
{
|
||||
id: selectedColumn,
|
||||
operator: operatorKey,
|
||||
value: value,
|
||||
value: preparedValue,
|
||||
arrayValues: arrayValues
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user