mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Session properties.
This commit is contained in:
parent
deb9dd60df
commit
fc1fc5807e
10 changed files with 64 additions and 22 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { ClickHouseClient, createClient } from '@clickhouse/client';
|
||||
import { formatInTimeZone } from 'date-fns-tz';
|
||||
import debug from 'debug';
|
||||
import { CLICKHOUSE } from 'lib/db';
|
||||
import { DEFAULT_PAGE_SIZE, OPERATORS } from './constants';
|
||||
|
|
@ -48,6 +49,10 @@ function getClient() {
|
|||
return client;
|
||||
}
|
||||
|
||||
function getUTCString(date?: Date) {
|
||||
return formatInTimeZone(date || new Date(), 'UTC', 'yyyy-MM-dd HH:mm:ss');
|
||||
}
|
||||
|
||||
function getDateStringSQL(data: any, unit: string = 'utc', timezone?: string) {
|
||||
if (timezone) {
|
||||
return `formatDateTime(${data}, '${CLICKHOUSE_DATE_FORMATS[unit]}', '${timezone}')`;
|
||||
|
|
@ -221,6 +226,7 @@ export default {
|
|||
getDateStringSQL,
|
||||
getDateSQL,
|
||||
getFilterQuery,
|
||||
getUTCString,
|
||||
parseFilters,
|
||||
pagedQuery,
|
||||
findUnique,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue