|
|
@ -3170,8 +3170,7 @@ class BaseModelSqlv2 { |
|
|
|
data = this.convertAttachmentType(data, childTable); |
|
|
|
data = this.convertAttachmentType(data, childTable); |
|
|
|
|
|
|
|
|
|
|
|
// update date time fields
|
|
|
|
// update date time fields
|
|
|
|
const isXcdbBase = await this.isXcdbBase(); |
|
|
|
data = this.convertDateFormat(data, childTable); |
|
|
|
data = this.convertDateFormat(data, isXcdbBase, childTable); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return data; |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |
|
|
@ -3215,7 +3214,6 @@ class BaseModelSqlv2 { |
|
|
|
private _convertDateFormat( |
|
|
|
private _convertDateFormat( |
|
|
|
dateTimeColumns: Record<string, any>[], |
|
|
|
dateTimeColumns: Record<string, any>[], |
|
|
|
d: Record<string, any>, |
|
|
|
d: Record<string, any>, |
|
|
|
isXcdbBase: BoolType, // TODO(timezone): remove
|
|
|
|
|
|
|
|
) { |
|
|
|
) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (d) { |
|
|
|
if (d) { |
|
|
@ -3233,11 +3231,7 @@ class BaseModelSqlv2 { |
|
|
|
return d; |
|
|
|
return d; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private convertDateFormat( |
|
|
|
private convertDateFormat(data: Record<string, any>, childTable?: Model) { |
|
|
|
data: Record<string, any>, |
|
|
|
|
|
|
|
isXcdbBase: BoolType, |
|
|
|
|
|
|
|
childTable?: Model, |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
// Show the date time in UTC format in API response
|
|
|
|
// Show the date time in UTC format in API response
|
|
|
|
// e.g. 2022-01-01 04:30:00+00:00
|
|
|
|
// e.g. 2022-01-01 04:30:00+00:00
|
|
|
|
if (data) { |
|
|
|
if (data) { |
|
|
@ -3246,11 +3240,9 @@ class BaseModelSqlv2 { |
|
|
|
).filter((c) => c.uidt === UITypes.DateTime); |
|
|
|
).filter((c) => c.uidt === UITypes.DateTime); |
|
|
|
if (dateTimeColumns.length) { |
|
|
|
if (dateTimeColumns.length) { |
|
|
|
if (Array.isArray(data)) { |
|
|
|
if (Array.isArray(data)) { |
|
|
|
data = data.map((d) => |
|
|
|
data = data.map((d) => this._convertDateFormat(dateTimeColumns, d)); |
|
|
|
this._convertDateFormat(dateTimeColumns, d, isXcdbBase), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this._convertDateFormat(dateTimeColumns, data, isXcdbBase); |
|
|
|
this._convertDateFormat(dateTimeColumns, data); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|