Browse Source

feat(nocodb): handle date month in API response

pull/6870/head
աɨռɢӄաօռɢ 1 year ago
parent
commit
e4ad0eb3d5
  1. 13
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -9,6 +9,7 @@ import { nocoExecute } from 'nc-help';
import {
AuditOperationSubTypes,
AuditOperationTypes,
isDateMonthFormat,
isLinksOrLTAR,
isSystemColumn,
isVirtualCol,
@ -4279,6 +4280,13 @@ class BaseModelSqlv2 {
continue;
}
if (col.uidt === UITypes.Date) {
const dateFormat = col.meta.date_format;
if (isDateMonthFormat(dateFormat)) {
d[col.title] = dayjs(d[col.title], dateFormat).format(dateFormat);
}
continue;
}
let keepLocalTime = true;
if (this.isSqlite) {
@ -4336,7 +4344,10 @@ class BaseModelSqlv2 {
const dateTimeColumns = (
childTable ? childTable.columns : this.model.columns
).filter(
(c) => c.uidt === UITypes.DateTime || c.uidt === UITypes.Formula,
(c) =>
c.uidt === UITypes.DateTime ||
c.uidt === UITypes.Date ||
c.uidt === UITypes.Formula,
);
if (dateTimeColumns.length) {
if (Array.isArray(data)) {

Loading…
Cancel
Save