Page 1 of 1

Week Number is wrong

Posted: Mon Jan 21, 2008 4:30 am
by Richard Naninck
Scott,

The Week Number from the System Time device is showing 3. I am sure that this is correct for the USA, but here in Europe we are living in week number 4. Not sure if you even want to address this, but you could calculate for the correct Week Number by interpreting the Lat / Long settings.

I will strip the display of the week number in my theme and replace it by the one I calculate myself. Last year was OK, but now it is wrong for Europe.

Posted: Mon Jan 21, 2008 5:14 am
by Richard Naninck
I did some searching and it appears that the USA should also be in week 4 now. My setup is showing week 3 and I am positive this is not going to change tomorrow because all of last week was showing week 2 whereas it should have been week 3. So we are one number short on the Week Number. Do you see the same?

Posted: Mon Jan 21, 2008 9:34 pm
by ScottBot
Well.... it works as documented.

Code: Select all

Week Number Displays the current week number of the year with Monday as first day of week (0 – 53). 
I admit that making it 0 based was probably not the most intuitive design.

Posted: Tue Jan 22, 2008 5:22 am
by Richard Naninck
OK and sorry. Didn't read the help on this topic. Zero based is strange though. That means that the current week number 3 + 1 is 4. But why was it OK last year? That's keeps me from using it with + 1 because it might be wrong again next year.

Posted: Tue Jan 22, 2008 8:18 am
by ScottBot
It should have been correct last year too. It's just using a standard library function to get this info, so I'm thinking it should be correct.

I do admit, it was probably not the best decision to leave it 0 based. I can probably change it, but it could mess up a Task or script someone has. Although I doubt that too many folks actually use it for anything.

Posted: Tue Jan 22, 2008 2:20 pm
by Richard Naninck
At work I asked some Americans what week they thought were living in and nobody actually uses it. I do use it a lot and so if not too many are suspected to use it anyways, then just change it;)

Posted: Tue Jan 22, 2008 2:25 pm
by ScottBot
Richard Naninck wrote:At work I asked some Americans what week they thought were living in ...
So you thought us Americans have a better handle on time :?: :wink:

I have a hard time remembering what day of the week it is, much less what week of the year.

Posted: Tue Jan 22, 2008 2:30 pm
by Richard Naninck
And so does the girlfriend. For some reason we (at work) seem to be the only ones using it. Our complete business planning is done using weeknumers so I figured it was a nice thing to display in my theme to keep better track of these numbers. I will check some old screenshots I took last year to see if the weeknumber fits the date.

Posted: Sun Jan 27, 2008 2:12 pm
by Richard Naninck
I just checked a screenshot I took on july 11 2007 and it showed week 28 which is correct. So the logic was OK last year, but isn't OK now. Please explain how that can happen if the system has always been zero based?

Posted: Sun Jan 27, 2008 6:12 pm
by ScottBot
It's a mystery to me. Nothing has changed in that area. It considers Monday as the first day of the week. Maybe that's it?

Posted: Sun Jan 27, 2008 6:21 pm
by Richard Naninck
I posted my first message last monday and it was off by 1. The screenshot I took was from a wednesday.
It just (15 minutes ago) turned to 4 here in Europe and it should be 5, but that is because it's zero based. Still doesn't explain the wednesday on july 11 2007.
Anyways, let it be but just keep it min mind. Maybe someday this minor thing will trigger something.
I will keep on using my own week calculation in script because just adding 1 to the system time.current week might set it wrong again next year.
Maybe I will test this on another PC and fiddle with the date on that PC to see what happens in 2007, 2008 and 2009. I might come up with something. If so, I will repost here.

Re: Week Number is wrong

Posted: Fri May 30, 2008 9:21 am
by Whistler
Hi all,

I think this is more a matter of perception and how weeknumbers is used. Not every country (or even region) uses the same calculation method.
In Outlook's Calendar you can show the weeknumbers and define how they should be calculated (in Calendar options).
Three options exist for "first week of the year":
- First full week
- First 4-day week
- Start on January 1st

With the current calculation, dependent on which day January first falls it could seem correct 1 year and wrong the next when compared to other's 'usage'. Something that could be added in a next release?

Side note: Nothing wrong with having 0-based numbering... this is sooooo common in C programming when working with arrays :wink:

Re: Week Number is wrong

Posted: Sun Feb 15, 2009 5:29 am
by Richard Naninck
Scott,

Now that we are in 2009 I got to check this again in a different year and it is still off by 1. Makes sense since it is zero based. Still no clue why 2007 was correct though. My question: Are going to add a 1 to the zero based value, or are you going to leave it the way it is (actually wrong so to speak)? If so, I will add the one myself.

@Whistler:

Yeah, nothing wrong with zero based values. I love them myself, but in this case it just doesn't make much sense since it is used for display and not for arrays. You could always subtract 1 again to get it zero based. It just makes more sense when it is correct especially since you don't notice easily that it is zero based when you start using it.

Re: Week Number is wrong

Posted: Sun Feb 15, 2009 12:52 pm
by ScottBot
It was just a low priority issue on my list that I never got to. I'll probably fix it at some point, but I can't say when.

Re: Week Number is wrong

Posted: Sun Feb 15, 2009 2:19 pm
by Richard Naninck
OK and thanks. However this strikes me as the easiest fix in HouseBot history :D