|
|
@ -541,6 +541,7 @@ async function _formulaQueryBuilder( |
|
|
|
if (knex.clientType().startsWith('mysql')) { |
|
|
|
if (knex.clientType().startsWith('mysql')) { |
|
|
|
aliasToColumn[col.id] = async (): Promise<any> => { |
|
|
|
aliasToColumn[col.id] = async (): Promise<any> => { |
|
|
|
return { |
|
|
|
return { |
|
|
|
|
|
|
|
// convert from DB timezone to UTC
|
|
|
|
builder: knex.raw( |
|
|
|
builder: knex.raw( |
|
|
|
`CONVERT_TZ(??, @@GLOBAL.time_zone, '+00:00')`, |
|
|
|
`CONVERT_TZ(??, @@GLOBAL.time_zone, '+00:00')`, |
|
|
|
[col.column_name], |
|
|
|
[col.column_name], |
|
|
@ -554,6 +555,7 @@ async function _formulaQueryBuilder( |
|
|
|
) { |
|
|
|
) { |
|
|
|
aliasToColumn[col.id] = async (): Promise<any> => { |
|
|
|
aliasToColumn[col.id] = async (): Promise<any> => { |
|
|
|
return { |
|
|
|
return { |
|
|
|
|
|
|
|
// convert from DB timezone to UTC
|
|
|
|
builder: knex |
|
|
|
builder: knex |
|
|
|
.raw( |
|
|
|
.raw( |
|
|
|
`?? AT TIME ZONE CURRENT_SETTING('timezone') AT TIME ZONE 'UTC'`, |
|
|
|
`?? AT TIME ZONE CURRENT_SETTING('timezone') AT TIME ZONE 'UTC'`, |
|
|
@ -566,7 +568,7 @@ async function _formulaQueryBuilder( |
|
|
|
knex.clientType() === 'mssql' && |
|
|
|
knex.clientType() === 'mssql' && |
|
|
|
col.dt !== 'datetimeoffset' |
|
|
|
col.dt !== 'datetimeoffset' |
|
|
|
) { |
|
|
|
) { |
|
|
|
// if there is no timezone info, convert to database timezone, then convert to UTC
|
|
|
|
// convert from DB timezone to UTC
|
|
|
|
aliasToColumn[col.id] = async (): Promise<any> => { |
|
|
|
aliasToColumn[col.id] = async (): Promise<any> => { |
|
|
|
return { |
|
|
|
return { |
|
|
|
builder: knex.raw( |
|
|
|
builder: knex.raw( |
|
|
|