MonthCal Week Number is incorrect on Windows 11 Topic is solved

Report problems with documented functionality
Satheeshkumar
Posts: 1
Joined: 28 Apr 2024, 12:37

MonthCal Week Number is incorrect on Windows 11

28 Apr 2024, 13:49

# Issue-1
As per the below given document, the Week number shall be 1 for Date [2-8] January 2023 which is shown as expected on Windows 10.
When I ran the same script with same version of AutoHotKey on Windows 11, the Week number shows incorrectly.
https://www.autohotkey.com/docs/v2/lib/GuiControls.htm#MonthCal_Options

# Issue-2
W-2 Option shows three months horizontally instead of 2 months
https://www.autohotkey.com/docs/v2/lib/GuiControls.htm#MonthCal

Code: Select all

MCGUI := Gui("+ToolWindow", "MonthCal-Test")
MCGUI.AddMonthCal("R1 W-2 4 vMC")
MCGUI.Show()
Return
image.png
Incorrect week numbers, AutoHotkey_v2.0.13 on Windows 11
image.png (25.61 KiB) Viewed 1467 times
image.png
Correct week numbers, AutoHotkey_v2.0.13 on Windows 10
image.png (21.93 KiB) Viewed 1467 times
lexikos
Posts: 9780
Joined: 30 Sep 2013, 04:07
Contact:

Re: MonthCal Week Number is incorrect on Windows 11

02 May 2024, 22:09

#1: As far as I am aware, AutoHotkey contains no direct support for "week numbers". Numeric options (style numbers) are just accumulated and then passed to the control via CreateWindowEx or SetWindowLong. The option is documented for your convenience, and the phrase "Week 1 is defined as the first week that contains at least four days" appears to have been copied verbatim from the Microsoft documentation. The actual behaviour is not specific to Windows 11, and is likely the same for all frameworks which use the MonthCal control.
The calculation for week numbering is determined by the operating system's user locale settings.
Source: .net - MonthCalendar control displaying non ISO-8601 compliant week numbers - Stack Overflow
If LOCALE_IFIRSTWEEKOFYEAR is 2, LOCALE_IFIRSTDAYOFWEEK is 0 (Monday), and LOCALE_ICALENDARTYPE is Gregorian, then the first week follows the ISO 8601 definition where the first week is the week with the first Thursday of the Gregorian year in it.
Source: LOCALE_IFIRSTWEEKOFYEAR - Win32 apps | Microsoft Learn
The fast solution to resolve this problem was to add on client PC, 2 in the iFirstweekofYear register instead of 0 (acces this register by running regedit->HKEY_CURRENT_USER->Control Panel->International->iFirstWeekOfYear)
Source: .net - MonthCalendar control displaying non ISO-8601 compliant week numbers - Stack Overflow
Actually, the results you get on Windows 11 seem to be what is expected for US regional settings.
Since the United States doesn’t use week numbers to any significant extent, the definitions are chosen to align with how people talk in casual conversation: “Week 1” is the first week of the year, and it begins on January 1. The weeks are then numbered consecutively, with each subsequent week starting in on Sunday.
...
I should emphasize that you will not see a calendar in the United States that looks like this, because nobody cares about week numbers.
Source: On week numbering in the United States - The Old New Thing
Personally, I either never heard of the ISO definition of week numbering, or didn't care enough to remember it. I guess Australia is like the US in that regard.


#2: Confirmed; this is caused by DPI scaling, so you can work around it with -DPIScale.
lexikos
Posts: 9780
Joined: 30 Sep 2013, 04:07
Contact:

Re: MonthCal Week Number is incorrect on Windows 11  Topic is solved

07 May 2024, 06:57

Fixed by v2.0.14 (documentation for #1, behaviour for #2).

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 8 guests