I’m importing content from a different system. Importing works fine, but I cannot change the content createdTime. From another thread it’s implied that it should be possible?
(I also want to change the modifiedTime, however I see that modifying modifiedTime is somewhat semantically odd, and might be immediately overridden by the system.)
Should it be possible? Dumping/exporting the data from XP, and modifying the files before importing them again seems like a wrong approach…
This is my code. I’ve tried a gazillion different timestamp and date formats, with no luck. Also, I get no error messages. The content for these two fields simply doesn’t change. Hopefully I’m just overseeing something obvious here.
if (result) {
var updatedPost = contentLib.modify({
key: result._id,
editor: function (c) {
c.createdTime = myImportedData.date_gmt;
c.modifiedTime = myImportedData.modified_gmt;
c.data.whatever = 'This is changed just fine';
return c;
}
});
if (!updatedPost) {
log.error('Unable to update ' + result._path + ' with new dates');
}
}