Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

I am trying to set doneDate currentDate onChange done field.

default discord avatar
anisulislampranto2 years ago
3

getting this error



  • discord user avatar
    alessiogr
    last year

    admin > date doesn't have a "condition" property. Conditions are used to conditionally show or hide fields depending on... some condition. You can't use them to set a field's value.



    It sounds like what you want would be a beforeChange hook (relevant docs page:

    https://payloadcms.com/docs/hooks/collections

    ).



    When the done field is modified, you can return a new value for the doneDate field inside the beforeChange hook

  • default discord avatar
    anisulislamprantolast year

    Worked. Thanks

  • default discord avatar
    etmartinkazoolast year

    Hi

    @854751864707874817

    - Would you have an example of your updated code using the beforeChange hook? I am looking to do something similar.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.