Browse Source

feat(nocodb): include timezone conversion for MSSQL formula

pull/5678/head
Wing-Kam Wong 2 years ago
parent
commit
7010f9142b
  1. 13
      packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts

13
packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts

@ -562,6 +562,19 @@ async function _formulaQueryBuilder(
.wrap('(', ')'),
};
};
} else if (
knex.clientType() === 'mssql' &&
col.dt !== 'datetimeoffset'
) {
// if there is no timezone info, convert to database timezone, then convert to UTC
aliasToColumn[col.id] = async (): Promise<any> => {
return {
builder: knex.raw(
`CONVERT(DATETIMEOFFSET, ?? AT TIME ZONE 'UTC')`,
[col.column_name],
),
};
};
} else {
aliasToColumn[col.id] = () =>
Promise.resolve({ builder: col.column_name });

Loading…
Cancel
Save