Simplifying date of December 31 of a given year results in year plus one

0
So part of my application has users selecting dates from date picker widgets. These dates are then presented in different formats throughout the app, normally as either Day/Month/Year, Month/Year, or just Year. What I’ve noticed is, when the user selects the date as 12/31/Year, when I go to format it as either Month/Year or just Year, the year is presented as ‘Year+1’. So if I had the date as 12/31/2021, formatting it as Month/Year would present the date as 12/2022. This has been causing issues within my application, as the dates being altered like this is resulting in some of the features of my application not processing the data properly. Is there a way to avoid the dates being altered like this by the formatting? I had originally thought it was caused by something done in one of my microflows, but I’m seeing that it’s happening when I change the formatting of the display of the date attribute. Thank you!
asked
2 answers
2

Maybe this is due to the way you show the date and the difference between ‘YYYY’ and ‘yyyy’. Instead of using ‘YYYY’, use ‘yyyy’ and try again.

answered
1

Have you read this: https://docs.mendix.com/refguide/datetime-handling-faq ?

All the dates are stored in UTC. What is your date setting of this date attribute? Because due to localization the date can change. And if you format it again are you using the same as you stored? It helps to download your database and restore it locally. Then you can look in the Postgress database the actual UTC values. That probably gives you a clear grasp what is going wrong. If you do not need the time part I would advise to store the value as UTC and use the UTC format functions to display again.

Regards,

Ronald

 

answered