The week number of 2020 - 2021 53 is missing / incorrect

0
Hi there, I'm working with the week number format, but the week number 53 doesn’t exist. Can you set that somewhere? ( week 1 starts the 28th of december, but that has to be week 53)
asked
6 answers
5

When calculating the week number, the user's locale is used. The locale is dependent on the user's language.

A user with language set to English, United States will see the week number for 2020-12-29 as 1.

A user with language set to Dutch, Netherlands will see the week number for 2020-12-29 as 53.


For 2021 it's exact;y the other way around: en_US has 53 weeks in 2021, nl_NL has only 52.

See also the release notes:
When formatting week numbers using the custom format symbol w, the resulting value was often incorrect. It is now based on the user locale and the First day of the week setting in the Desktop Modeler project Settings. Additionally, the uppercase Y format symbol was added for the year corresponding to the week number (which may be different from the actual year of the date).

answered
1

He Marlin,

Did you check out this documentation: https://docs.mendix.com/refguide/xpath-week-from-datetime

answered
1

Looks like a bug. Week 53 of 2020 starts on the 28th December 2020 and lasts until 3rd January 2021.

-Andrej

answered
0

There is a bug with Mendix parseDateTimeUTC and formatDateTimeUTC when using ‘w’ for week number with last week of year.

parseDateTimeUTC and formatDateTimeUTC should be inverse

Here is reproduction example (Mendix 7.23.19)

parseDateTimeUTC(formatDateTimeUTC(parseDateTimeUTC('2020-12-21 15:51:09', 'yyyy-MM-dd HH:mm:ss'), 'yyyy w u HH:mm:ss'), 'yyyy w u HH:mm:ss')
UTC time: 2020-12-21 15:51:09.000

parseDateTimeUTC(formatDateTimeUTC(parseDateTimeUTC('2020-12-28 15:51:09', 'yyyy-MM-dd HH:mm:ss'), 'yyyy w u HH:mm:ss'), 'yyyy w u HH:mm:ss')
UTC time: 2019-12-30 15:51:09.000

answered
0

New to this, but how does one report bugs to Mendix like the one above? Do we wait till someone from Mendox sniffs the forum for the word bug or are we able to put it into a Jira or something like that?

Just trying to learn and figure out if someone has submitted this as a bug as I also am affected by this in my code.

answered
0

If you are using the community commons ‘get week number from date’ , this is not working for either the us or nl setting. I found the following on stackoverflow. By adding the minimal number of days to the java action, it will correctly show week 53 . So, edit the java action and add the line below after setting the variable.

 

cal.setMinimalDaysInFirstWeek(4); // For ISO 8601

answered