Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

revert getDateStringSQL for CH

Francis Caoa3f32b036d25
diff --git a/src/lib/clickhouse.ts b/src/lib/clickhouse.ts
index 652b9d118..4880e122e 100644
--- a/src/lib/clickhouse.ts
+++ b/src/lib/clickhouse.ts
@@ -51,12 +51,12 @@ function getUTCString(date?: Date | string | number) {
return formatInTimeZone(date || new Date(), 'UTC', 'yyyy-MM-dd HH:mm:ss');
}
-function getDateStringSQL(field: string, unit: string, timezone?: string) {
+function getDateStringSQL(data: any, unit: string = 'utc', timezone?: string) {
if (timezone) {
- return `formatDateTime(${field}, '${CLICKHOUSE_DATE_FORMATS[unit]}', '${timezone}')`;
+ return `formatDateTime(${data}, '${CLICKHOUSE_DATE_FORMATS[unit]}', '${timezone}')`;
}
- return `formatDateTime(${field}, '${CLICKHOUSE_DATE_FORMATS[unit]}')`;
+ return `formatDateTime(${data}, '${CLICKHOUSE_DATE_FORMATS[unit]}')`;
}
function getDateSQL(field: string, unit: string, timezone?: string) {