mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
fix clickhouse date timezone issues
This commit is contained in:
parent
fc3c39be3c
commit
55ba7d95ab
7 changed files with 7647 additions and 4840 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { PrismaClient } from '@prisma/client';
|
||||
import { ClickHouse } from 'clickhouse';
|
||||
import { Kafka } from 'kafkajs';
|
||||
import dateFormat from 'dateformat';
|
||||
import chalk from 'chalk';
|
||||
import {
|
||||
MYSQL,
|
||||
|
|
@ -164,13 +165,13 @@ export function getDateQuery(field, unit, timezone) {
|
|||
|
||||
export function getDateQueryClickhouse(field, unit, timezone) {
|
||||
if (timezone) {
|
||||
return `date_trunc('${unit}', ${field},'${timezone}')`;
|
||||
return `date_trunc('${unit}', ${field}, '${timezone}')`;
|
||||
}
|
||||
return `date_trunc('${unit}', ${field})`;
|
||||
}
|
||||
|
||||
export function getDateFormatClickhouse(date) {
|
||||
return `parseDateTimeBestEffort('${date.toUTCString()}')`;
|
||||
return `'${dateFormat(date, 'UTC:yyyy-mm-dd HH:MM:ss')}'`;
|
||||
}
|
||||
|
||||
export function getBetweenDatesClickhouse(field, start_at, end_at) {
|
||||
|
|
@ -357,3 +358,7 @@ export async function kafkaProducer(params, topic) {
|
|||
],
|
||||
});
|
||||
}
|
||||
|
||||
export function getDateFormatKafka(date) {
|
||||
return dateFormat(date, 'UTC:yyyy-mm-dd HH:MM:ss');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue