Browse Source

fix: handle created/lastmodified column as datetime in formula

pull/7304/head
Pranav C 10 months ago
parent
commit
bb61a7de7d
  1. 7
      packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts

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

@ -20,6 +20,7 @@ import { CacheGetType, CacheScope } from '~/utils/globals';
import { convertDateFormatForConcat } from '~/helpers/formulaFnHelper'; import { convertDateFormatForConcat } from '~/helpers/formulaFnHelper';
import FormulaColumn from '~/models/FormulaColumn'; import FormulaColumn from '~/models/FormulaColumn';
import { Base, BaseUser } from '~/models'; import { Base, BaseUser } from '~/models';
import { getRefColumnIfAlias } from '~/helpers';
const logger = new Logger('FormulaQueryBuilderv2'); const logger = new Logger('FormulaQueryBuilderv2');
@ -637,7 +638,12 @@ async function _formulaQueryBuilder(
}; };
}; };
break; break;
case UITypes.CreateTime:
case UITypes.LastModifiedTime:
case UITypes.DateTime: case UITypes.DateTime:
{
const col = await getRefColumnIfAlias(col);
if (knex.clientType().startsWith('mysql')) { if (knex.clientType().startsWith('mysql')) {
aliasToColumn[col.id] = async (): Promise<any> => { aliasToColumn[col.id] = async (): Promise<any> => {
return { return {
@ -681,6 +687,7 @@ async function _formulaQueryBuilder(
aliasToColumn[col.id] = () => aliasToColumn[col.id] = () =>
Promise.resolve({ builder: col.column_name }); Promise.resolve({ builder: col.column_name });
} }
}
break; break;
case UITypes.User: case UITypes.User:
{ {

Loading…
Cancel
Save