mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-03 18:57:35 +01:00
fix: wrong datetime conversion when updating a row without an unique key
This commit is contained in:
parent
bb5f44681f
commit
d374372e20
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user