Merge pull request #4397 from Sagittarius/codex/clickhouse-22-date-format

fix: support ClickHouse 22 date formats
This commit is contained in:
Mike Cao authored and GitHub committed 2026-07-24 21:26:39 -07:00
commit 0714ebdbe3
3 files changed
+19 -5

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
import { describe, expect, test } from 'vitest';
import { CLICKHOUSE_DATE_FORMATS } from './clickhouse';
describe('CLICKHOUSE_DATE_FORMATS', () => {
test('uses date format tokens compatible with ClickHouse 22.8 and newer', () => {
expect(CLICKHOUSE_DATE_FORMATS).toMatchObject({
utc: '%Y-%m-%dT%TZ',
second: '%Y-%m-%dT%T',
minute: '%Y-%m-%d %R:00',
});
});
});
+5 -3
View File
@@ -7,9 +7,11 @@ import { filtersObjectToArray } from './params';
import type { Operator, PropertyFilter, QueryFilters, QueryOptions } from './types';
export const CLICKHOUSE_DATE_FORMATS = {
utc: '%Y-%m-%dT%H:%i:%SZ',
second: '%Y-%m-%dT%H:%i:%S',
minute: '%Y-%m-%d %H:%i:00',
// %i is unsupported by ClickHouse before v23.4. %T and %R work on both
// older and newer versions while retaining the intended ISO time format.
utc: '%Y-%m-%dT%TZ',
second: '%Y-%m-%dT%T',
minute: '%Y-%m-%d %R:00',
hour: '%Y-%m-%d %H:00:00',
day: '%Y-%m-%d',
month: '%Y-%m-01',