Browse Source

fix(nocodb): convertDateFormat for all types

pull/5642/head
Wing-Kam Wong 2 years ago
parent
commit
331b48cf9b
  1. 6
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -3238,11 +3238,9 @@ class BaseModelSqlv2 {
isXcdbBase: BoolType, isXcdbBase: BoolType,
childTable?: Model, childTable?: Model,
) { ) {
// MySQL converts TIMESTAMP values from the current time zone to UTC for storage. // Show the date time in UTC format in API response
// Then, MySQL converts those values back from UTC to the current time zone for retrieval.
// To make it consistent with other DB types, we show the result in UTC instead
// e.g. 2022-01-01 04:30:00+00:00 // e.g. 2022-01-01 04:30:00+00:00
if (this.isMySQL && data) { if (data) {
const dateTimeColumns = ( const dateTimeColumns = (
childTable ? childTable.columns : this.model.columns childTable ? childTable.columns : this.model.columns
).filter((c) => c.uidt === UITypes.DateTime); ).filter((c) => c.uidt === UITypes.DateTime);

Loading…
Cancel
Save