parseInterger(formatdatetime($StartDateOfTheWeek, yyyy) with $StartDateOfTheWeek = UTC time: 2021-12-27 results in wrong Year 2022

Hello everybody,   When i use parseInteger(formatdatetime($StartDateOfTheWeek, 'yyyy') with the following settings, i am receiving the wrong year:   Generating Timesheets via defining Start Date of the week         ​​​​​​​     Result 4.    Does anybody have an idea why it is generating in this case “2022”??? It think it should create “2021” with this configuration, right?  
3 answers

What could be, but I can't say for sure from your story, is that the following is going on:

As crazy as it may sound, week 52 can also be the first week of the year. This is because in the middle of the week, for example, the transition from year 2021 to 2022 takes place. So in this case week 52 will be seen as the "first" week of 2022. Perhaps for that reason the first day of the week also falls in 2022.

Assuming it will work with a week that is far from the New Year's?


The kind of result you are getting can be because of using ‘YYYY’ in your formatDateTime, but as I see in the screenshot you are using ‘yyyy’ which is fine.

To explain more:

yyyy → gives the year for that date

YYYY → gives the year for that week

Considering that the week finishes in 2022, using YYYY will give 2022 as output.

But indeed, reading your explaination and setup this looks strange


Now i am totally confused. i have changed my microflow a little bit to check what kind of variable is creating during the microflow:


Added this:

with the following setup:





Changed the following component:







What the hell? Is this a bug?