Browse Source

fix: use correct datetime format based on current source(datasource)

pull/7551/head
Pranav C 10 months ago
parent
commit
904853b12f
  1. 12
      packages/nocodb/src/db/BaseModelSqlv2.ts

12
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -5763,7 +5763,7 @@ class BaseModelSqlv2 {
);
if (lastModifiedTimeColumn) {
updateObject[lastModifiedTimeColumn.column_name] = Noco.ncMeta.now();
updateObject[lastModifiedTimeColumn.column_name] = this.now();
}
if (lastModifiedByColumn) {
@ -5798,13 +5798,13 @@ class BaseModelSqlv2 {
if (column.system) {
if (isInsertData) {
if (column.uidt === UITypes.CreatedTime) {
data[column.column_name] = Noco.ncMeta.now();
data[column.column_name] = this.now();
} else if (column.uidt === UITypes.CreatedBy) {
data[column.column_name] = cookie?.user?.id;
}
}
if (column.uidt === UITypes.LastModifiedTime) {
data[column.column_name] = isInsertData ? null : Noco.ncMeta.now();
data[column.column_name] = isInsertData ? null : this.now();
} else if (column.uidt === UITypes.LastModifiedBy) {
data[column.column_name] = isInsertData ? null : cookie?.user?.id;
}
@ -5946,6 +5946,12 @@ class BaseModelSqlv2 {
}
}
}
public now() {
return dayjs()
.utc()
.format(this.isMySQL() ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ');
}
}
export function extractSortsObject(

Loading…
Cancel
Save