Page 1 of 1
MonthCal Week Number is incorrect on Windows 11
Posted: 28 Apr 2024, 13:49
by Satheeshkumar
# 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
- Incorrect week numbers, AutoHotkey_v2.0.13 on Windows 11
- image.png (25.61 KiB) Viewed 942 times
- Correct week numbers, AutoHotkey_v2.0.13 on Windows 10
- image.png (21.93 KiB) Viewed 942 times
Re: MonthCal Week Number is incorrect on Windows 11
Posted: 02 May 2024, 22:09
by lexikos
#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.
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
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.
Re: MonthCal Week Number is incorrect on Windows 11 Topic is solved
Posted: 07 May 2024, 06:57
by lexikos
Fixed by v2.0.14 (documentation for #1, behaviour for #2).