 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
TedStriker
Joined: 15 Jan 2008 Posts: 22
|
Posted: Fri Feb 26, 2010 11:52 pm Post subject: Monthcal - Week numbers wrong |
|
|
I need a little calendar with week display sometimes. I used "BetaClock" for this, but it stopped working under Win7. The next best thing I found was "Amp Calendar" but it calculated the weeks wrong for 2010 . So finally I thought I should just use AHK (1.0.48.05). But what do you know, AHK also calculates the weeks wrong. At least the help file says it should calculate the weeks correctly, so I report it as bug.
| Quote: | | 4: Specify the number 4 in Options to display week numbers (1-52) to the left of each row of days. Week 1 is defined as the first week that contains at least four days. |
| Code: |
Gui +AlwaysOnTop +Owner
Gui, Add, MonthCal, 4 x2 y0 w190 h160,
Gui, Show, x276 y398 h166 w197, Calendar
Return
GuiClose:
ExitApp |
And here's what it looks like (Win7 64bit):
Week 1 should start, just as the help files says (and some ISO definition on Wikipedia) with fourth of January. |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6836 Location: France (near Paris)
|
Posted: Sat Feb 27, 2010 6:12 pm Post subject: |
|
|
I am suspecting both AMP Calendar and AutoHotkey to rely on Windows' API to get the date information, not calculating manually.
For the record, I found an interesting article: Calculating the ISO week number which defines "week 1 of a given year is the one that includes the first Thursday of that year. (or, equivalently, week 1 is the week that includes 4 January.)", so, indeed, according to this rule, this year's first week starts on January 4.
I was wondering about your post because I have AMP Calendar (a good, lightweight application) and I ran your script.
Both correctly report first week starting on January 4...
Then I had a suspicion... I went to the computer of my wife, running Windows 7. Lo! The calendar utility shown week 1 on first day of January...
I don't know which system they use (apparently there are several...) but it is.. disconcerting! It won't ease communication between one person on Windows XP (like me) and Windows 7! ("the deadline is set on week 11")...
Well, the conclusion is that this is not a bug in AHK...
[EDIT] For the record, it seems to be an old problem with MS products...
See Week numbers in Outlook Calendar are not consistent with Europe and Outlook 2002 shows wrong week numbers (last message, particularly: looks like we can change that in Outlook).
Apparently, Windows 7 beta has No week numbers in calendar, but they fixed that later, but incorrectly as it seems... Or inconsistently. Note that XP doesn't show week numbers either. I also notice: we have a calc, but no cal out of the box (beside these dialogs to change date/time)?
See also CalendarWeekRule Enumeration (found that by looking at the Determining the week number of 31/12/2008, because .NET is wrong thread where I found three links to various bug reports at Microsoft's site, with confusing answers from Microsoft...).
Apparently, the rules are culture dependent (as I guessed) and thus depend on the chosen parameter.
I still think it is strange to have differences between Windows XP and 7 (for the same locale, French in my case!). _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Last edited by PhiLho on Sun Feb 28, 2010 1:07 pm; edited 1 time in total |
|
| Back to top |
|
 |
nick
Joined: 24 Aug 2005 Posts: 549 Location: Berlin / Germany
|
Posted: Sun Feb 28, 2010 6:21 am Post subject: |
|
|
| The help for FormatTime wrote: | | WDay: Day of the week (1 – 7). Sunday is 1. |
So isn't it somewhat consistent (for MS at least)? _________________ nick  |
|
| Back to top |
|
 |
TedStriker
Joined: 15 Jan 2008 Posts: 22
|
Posted: Mon Mar 01, 2010 2:16 pm Post subject: |
|
|
Thanks for your post, PhiLho.
This is interesting. I tried the same script at my workplace (Windows XP, same region setting (German), Monday = first day of week) and it displays the correct week.
Ha! Now I understand why the author of AMP Calendar never bothered to reply my e-mail. He must have thought I'm crazy.
So, there, another one of the "worked flawlessly under Windows XP, but somehow not under Windows 7" bugs I encountered (like Desktop stops auto-refresh, audio crackles under CPU load, energy settings won't remember power-button setting). There's nothing I can do, but hope the first service pack will fix such tiny bugs.
| Quote: | | Well, the conclusion is that this is not a bug in AHK... |
The help file let me hope AHK would have own routines to calculate the work week and not rely on Windows. Perhaps this will be changed, seeing Microsoft has some problems with it.
| Quote: | | old problem with MS products... |
I know MS Access has problems with it, since ages (Access 2000). That's why I use a script-function which transforms a date to (correct) week number and do not use Access internal function.  |
|
| Back to top |
|
 |
TedStriker
Joined: 15 Jan 2008 Posts: 22
|
Posted: Thu Mar 11, 2010 8:07 pm Post subject: |
|
|
FWIW... I found a solution for Win7 in this old thread: http://www.autohotkey.com/forum/topic991.html
HKEY_CURRENT_USER\Control Panel\International\iFirstWeekOfYear
Set it to 1 and voila... Correct ISO 8601 week display in MonthCal (or AMP calendar).
The variable A_YWeek is not affected by this registry setting. It always calculates the ISO 8601 week. So I still wish MonthCal would use A_YWeek and not rely on Windows. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|