ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > Living Room

Windows 7 Breaks Week Numbering

(1/4) > >>

Stoic Joker:
Okay, so I got a bugg report regarding week numbering being wrong on T-Clock 2010's pop-up calendar (after Jan 2011). Now the calendar gets its week numbering from the Windows system ... So it should be impossible to screw up... Ha!

I first confirmed that the week numbering was indeed wrong ... Which is odd because it was right just last week/year...

Now here's the weird part:
Outlook 2007's calendar running on my Win7 x64 development machine, also displays the week number incorrectly. But, the WinXP VPC running on the same machine shows the week numbers correctly.

Saturday, January 1st, should be week 0, as the MSDN states (in the documentation for the Calendar Control) that week 1 is the first week of the year with 4 days in it. But Windows 7 appears to want to call it week 1. Which (of course) throws off the week numbering for the entire year.

Has anyone else heard of, or ran across this bizarre behavior?

Ath:
AFAIK, January 1st and 2nd are part of week 52 of last year or indeed week 0 of this year, depending on convention. This with Monday being the first day of the week, that is ;)
I've been implementing this 'week' (or was it 'weak' :-[) function some 15 years ago, and had kind of the same trouble then, but without the internet to search it was a lot harder to find a proper solution... eventually the 3 or 4 day minimum length (depending on Sunday or Monday as the first weekday) for week 1 popped up, and I was able to resolve it by dropping the extra days in week 52/53 of last year. Week 0 has always seemed quite impossible to me...
Though it looked odd to me for a long time, I've just been ignoring the 'strange' week numbers at the start of the year, but ofcourse in my case there's nothing life-threatening depending on it.

mwb1100:
Saturday, January 1st, should be week 0, as the MSDN states (in the documentation for the Calendar Control) that week 1 is the first week of the year with 4 days in it. But Windows 7 appears to want to call it week 1. Which (of course) throws off the week numbering for the entire year.
-Stoic Joker (January 16, 2011, 04:37 PM)
--- End quote ---

Can you post some code (or be quite specific about the Calendar control/class you're using)?  The MSDN docs for the Calendar class's `GetWeekOfYear()` method indicate that you have to pass in a CalendarWeekRule that would specify whether the 1st week:


* starts on the first day of the year
* is the first full week
* is the first with 4 days in it
Are you using something else, or could you possibly be passing in the wrong CalendarWeekRule value?

See http://msdn.microsoft.com/en-us/library/system.globalization.calendar.getweekofyear.aspx

wr975:
Has anyone else heard of, or ran across this bizarre behavior?
-Stoic Joker (January 16, 2011, 04:37 PM)
--- End quote ---

I had this problem a year ago with AHK. See this thread:

http://www.autohotkey.com/forum/viewtopic.php?t=55056

There's a registry setting to change this behavior, but I guess it would be best if your tool isn't relying on Windows, but calculates the week numbers on its own following this iso standard.

Stoic Joker:
Curiouser and curiouser this gets...

Just as a recap; There are three sources of week numbering I'm working with:
T-Clock's Custom Format String, which has been correct throughout the testing.
MS Outlook's Calendar (Both 2007 & 2010), which has been wrong throughout the testing.
T-Clock's Pop-up Calendar, which was wrong ... But now displays correctly after setting wr975 regestry key: HKEY_CURRENT_USER\Control Panel\International\iFirstWeekOfYear to 1.

Can you post some code (or be quite specific about the Calendar control/class you're using)?-mwb1100 (January 17, 2011, 02:12 AM)
--- End quote ---

Well.. T-Clock is still being compiled as pure C code - (Stop Laughing...) - So the only code used to create the control is this:

--- Code: C ---case WM_INITDIALOG: // Display 1 Month, 3 Months, or Full Year Calendar                ivMonths = GetMyRegLongEx("Calendar", "ViewMonths", 1); // New Feature - Coming Soon!           if(GetMyRegLong("Calendar", "ShowWeekNums", FALSE)) {                  dwCalStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|MCS_NOTODAYCIRCLE|MCS_WEEKNUMBERS;          }else{                  dwCalStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|MCS_NOTODAYCIRCLE;          }           hCal = CreateWindowEx(0, MONTHCAL_CLASS, "", dwCalStyle, 0,0,0,0, hDlg, 0, 0, NULL);
The calendar control defaults to today's date, so there really isn't any provision for feeding it (anything) GetWeekOfYear() - Which I seem to recall using successfully elseware in the Custom Format String code.

The question at this point, is if I add an option to adjust wr975's iFirstWeekOfYear registry entry ... Will that create a potential problem for other applications running on the user's machine?? (e.g. Sure it's easy as hell to do, but should it be done?)

Side Note:
Both the XP VPC and the Win7 Host machine started with a default value of 0 for iFirstWeekOfYear.
XP numbers the weeks correctly with either 1 or 0 as a value.
Win7 (both x86 & x64) required iFirstWeekOfYear to be set to 1.

*Shrug* ...7 is broken?

Navigation

[0] Message Index

[#] Next page

Go to full version