[DONE] Calculation of date / time is wrong

I have a date field with start time:

image

I then calculate with this formular

moment(@Termin).format('DD.MM.YYYY - HH:MM')

Result should not be:

image

  1. why is it 6 min? - the 6 min are not related to the creation time, as it was around min 15…
  2. what are the timezones? - do I need to add timezones? It should just pick the shown date and convert the string.

I expected: “28.06.2023 - 14:00”

Hi Dirk,

thanks for bringing this up - let’s solve your issue right away.

There are two aspects leading to the unexpected behaviour.

The first thing is your format string. The capital letter M refers to the month, see here. So what you meant to write was most likely this format string: DD.MM.YYY - HH:mm. That will improve the result and remove the “mysterious 6”, but still display the date in UTC:
Screenshot 2023-06-06 at 17.19.43

The reason is that Tape calculation fields always run in UTC, as they need to work the same for every user and organization. However, if you need to format the date relative in a certain timezone, it can be easily done using this code:

moment(@YourToken).tz("Europe/Amsterdam").format('DD.MM.YYYY - HH:mm')

Now, we receive the expected output:

Screenshot 2023-06-06 at 17.20.52

I hope that solves your problem. Feel free to reach out here if you have further questions regarding this.

Cheers
Tim

1 Like

Great - another “layer 8” issue solved. Thanks a lot for the speedy response.

1 Like