Skip to content

Commit

Permalink
Fix edit in grid for date fields with date column type (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
markus-moser authored Jun 11, 2024
1 parent f05b8a1 commit 7fe0a2d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions public/js/pimcore/object/tags/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ pimcore.object.tags.date = Class.create(pimcore.object.tags.abstract, {
}

if (value) {
var timestamp = intval(value) * 1000;
var date = new Date(timestamp);
let date;
if (typeof value === "string" && value.match(/-/)) {
date = new Date(value);
} else {
let timestamp = intval(value) * 1000;
date = new Date(timestamp);
}

return Ext.Date.format(date, "Y-m-d");
}
Expand Down Expand Up @@ -118,6 +123,9 @@ pimcore.object.tags.date = Class.create(pimcore.object.tags.abstract, {
},

getCellEditValue: function () {
if (this.fieldConfig.columnType === "date") {
return this.getValue();
}
return this.getValue() / 1000;
},

Expand Down

0 comments on commit 7fe0a2d

Please sign in to comment.