Right now I'm working on a case where I need to change the createdAt date made when a collection is made. Does anyone know how to do this? I've already tried adding a field called createdAt with type date to my collection, but when I change the value through this and save, the actual will always revert back to it's initial date.
You could try changing it in a
beforeChange
hook:
https://payloadcms.com/docs/hooks/collections#beforechangeHowever, I'm not totally sure at what point the timestamps are injected. If they are not there yet you could try updating the document in an
afterChange
hook.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.