Skip to content
Discussion options

You must be logged in to vote

I got it working!

import { Field } from 'payload/types';

const CreatedAt: Field = {
  name: 'createdAt',
  type: 'number',
  admin: {
    disabled: true,
  },
  hooks: {
    beforeChange: [(args) => {
      if (args.operation == 'create') {
        return (new Date).getTime();
      }
    }]
  }
}

export default CreatedAt;

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@JarrodMFlesch
Comment options

@JarrodMFlesch
Comment options

@ericuldall
Comment options

Answer selected by ericuldall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants