From d374372e208318d7e50b258a8041145bdf7992c5 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Wed, 7 Apr 2021 15:05:11 +0200 Subject: [PATCH] fix: wrong datetime conversion when updating a row without an unique key --- src/renderer/components/WorkspaceQueryTable.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/renderer/components/WorkspaceQueryTable.vue b/src/renderer/components/WorkspaceQueryTable.vue index 3bc53823..85e09121 100644 --- a/src/renderer/components/WorkspaceQueryTable.vue +++ b/src/renderer/components/WorkspaceQueryTable.vue @@ -86,6 +86,7 @@ import BaseVirtualScroll from '@/components/BaseVirtualScroll'; import WorkspaceQueryTableRow from '@/components/WorkspaceQueryTableRow'; import TableContext from '@/components/WorkspaceQueryTableContext'; import { mapActions, mapGetters } from 'vuex'; +import moment from 'moment'; export default { name: 'WorkspaceQueryTable', @@ -298,6 +299,17 @@ export default { delete row._id; delete orgRow._id; + Object.keys(orgRow).forEach(key => { // remap the row + if (orgRow[key] instanceof Date && moment(orgRow[key]).isValid()) { // if datetime + let datePrecision = ''; + const precision = this.fields.find(field => field.name === key).datePrecision; + for (let i = 0; i < precision; i++) + datePrecision += i === 0 ? '.S' : 'S'; + + orgRow[key] = moment(orgRow[key]).format(`YYYY-MM-DD HH:mm:ss${datePrecision}`); + } + }); + const params = { primary: this.primaryField.name, schema: this.getSchema(this.resultsetIndex),