Add shift on calendar

Hello all.

I can found shift on date function but i can't found shift function on calendar.

You have info ?

Big thanks :grin:

{formdate: D MMMM YYYY}

Hi @Emmett,

Welcome to the forum :slightly_smiling_face:
You can do that by specifying the formatter function where I am using:

  • datetimeparse to convert the value into the standard format
  • datetimeadd to perform the shift
  • datetimeformat to convert it back to the required format
    You can check our docs for more information here.

{formdate: D MMMM YYYY; formatter=(value) -> datetimeformat(datetimeadd(datetimeparse(value, "D MMMM YYYY"), 9, "D"), "D MMMM YYYY"); name=date}

I can't use it. This does not apply, in your case, 9 days more.

If it's possible, i have idea.

For example, today is the 12th, is it possible then, when I select the 12th, it says the word "today" instead of the date, if I select the next day , on the 13th, it is indicated instead of the date "tomorrow", and beyond that it indicates the completely normal date.

{formdate: YYYY-MM-DD; name=date}
{time: YYYY-MM-DD; at={=date}; pattern=YYYY-MM-DD }

Hi @Emmett,

I am not sure if I understood your use case correctly, but this snippet produces the expected result.

{formdate: YYYY-MM-DD; name=date}
{today_date=datetimeformat(now(), "YYYY-MM-DD")}{if: date=today_date}today{elseif: date=datetimeformat(datetimeadd(today_date,1,"D"), "YYYY-MM-DD")}tomorrow{else}{=date}{endif}

It's totally that ! Very powerfull.

I adapt but i have a bug. I convert date for French version but there is an error.

With "dddd D MMMM YYYY"

{formdate: dddd D MMMM YYYY; name=date}
{today_date=datetimeformat(now(), "dddd D MMMM YYYY")}
{if: date=today_date}today{elseif: date=datetimeformat(datetimeadd(today_date,1,"D"), "dddd D MMMM YYYY")}tomorrow{else}{=date}{endif}

Actually, you have to convert today_date into a standard format using datetimeparse before shifting it. I have made the required changes.

{formdate: dddd D MMMM YYYY; name=date}
{today_date=datetimeformat(now(), "dddd D MMMM YYYY")}
{if: date=today_date}today{elseif: date=datetimeformat(datetimeadd(datetimeparse(today_date, "dddd D MMMM YYYY"),1,"D"), "dddd D MMMM YYYY")}tomorrow{else}{=date}{endif}

Powerfull !!!!!! Big thanks :slight_smile:

1 Like