I’m trying to use WIX.update to update that timestamp but keep getting error WDE0004 Failed to save {your item name} into {your collection name}. Items must be JavaScript objects.
What format for date should I use to get it to write?
I’ve tried so many variations, examples below, I keep getting this error:
var now = new Date()
var nowTimeStamp = now.getTime();
const event = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
let event = “2018-01-01T23:00:00:000Z”;
I want to update the collection with the current date and time stamp, thoughts?
It looks like the issue might be that the Date field only takes date (not time). You can see this reference for more info on date and time in velo.
But for your purposes, the simpler solution might be to use the Wix CMS’s built-in updated and created date fields. When you create or update an item to the CMS, it will automatically keep track of the timestamp for you. They are hidden by default, but if you go to “manage fields” in your collection, you can toggle to view them.
I’m looking to sync a collection externally and planned to use this date/timestamp to only sync the deltas using .GE(timestamp). Unfortunately I don’t think the built in would assist with this.