Browse Source

fix: handle created/lastmodified column as datetime in formula

pull/7304/head
Pranav C 11 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 FormulaColumn from '~/models/FormulaColumn';
import { Base, BaseUser } from '~/models';
import { getRefColumnIfAlias } from '~/helpers';
const logger = new Logger('FormulaQueryBuilderv2');
@ -637,7 +638,12 @@ async function _formulaQueryBuilder(
};
};
break;
case UITypes.CreateTime:
case UITypes.LastModifiedTime:
case UITypes.DateTime:
{
const col = await getRefColumnIfAlias(col);
if (knex.clientType().startsWith('mysql')) {
aliasToColumn[col.id] = async (): Promise<any> => {
return {
@ -681,6 +687,7 @@ async function _formulaQueryBuilder(
aliasToColumn[col.id] = () =>
Promise.resolve({ builder: col.column_name });
}
}
break;
case UITypes.User:
{

Loading…
Cancel
Save