How to set a date-field with a default date in the future (Blog: Feature article until 3 month from now...)

I am coding a blog. Inside this Blog you can feature an article (on the frontpage).

Here is my YAML:

datumStartseite:

            label: Auf Startseite bis zum...
            type: date
            time: true
            default: now

Here is what I want: The ‘default’ value is supposed to be “in 3 month”. I can use min and max to set dates, but I need that date to be relative to todays (aka: “in 3 month”, not “Oktober 25 2020”).

If that is possible I cannot find a way reading https://getkirby.com/docs/reference/panel/fields/date

Thank you :slight_smile:

datumStartseite:
  type: date
  time: true
  disabled: true #optional
  default: now + 3 month
1 Like

Wow, that is very simple…

And it works, so thank you very much.

Even knowing that cool solution I cannot find that in the documentation. I searched for “month” and found 34 occurences of the word, all but 3 of them in the Kirby Episodes. Perhaps this is missing in the docs (or I am searching in the wrong places).

Again: Thank you for the help, that is a perfectly fine solution for me!

It’s not in the docs. I just thought it could work and tested it…

1 Like

I believe this deserves a mention in the docs! :~)

1 Like