News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Week 52 and 1 overlap when monday first day of the week

Started by Hakala, March 27, 2012, 05:34:01 AM

Previous topic - Next topic

Hakala

I recently installed 2.0.2 and now when browsing the calendar found that week numbers didn't match. After changing the setting where monday is the first day of the week I noticed that week 52/2011 ended on sunday which also appeared to start week 1.
Can anyone verify this?

Mods installed:
SimplePortal 2.3.5 RC1
Aeva Media 1.4w

emanuele

Hello Hakala and welcome to sm.org!

I think I've already seen the problem reported somewhere, probably not here, though.

* emanuele goes looking for the other topic to see if it is the same.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Hakala

Quote from: emanuele on March 27, 2012, 05:42:21 AM
Hello Hakala and welcome to sm.org!
Thank you!

Quote from: emanuele on March 27, 2012, 05:42:21 AM
I think I've already seen the problem reported somewhere, probably not here, though.

* emanuele goes looking for the other topic to see if it is the same.
I also did a quick search before posting but didn't find anything similar. It's good to know the issue might not be in my setup here.

emanuele

Okay, well...what I had in mind was a bit hidden... :P

Could be something like that?


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Hakala

Quote from: emanuele on March 27, 2012, 07:52:19 AM
Could be something like that?

Ummm... no. But that's weird too. ;D
Something like in the attached picture.

emanuele



Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Hakala

:laugh:
Well that's starting to look more like what I'm dealing with...
I guess there hasn't been any breakthroughs on this issue lately?

emanuele

Not really... :laugh: ...
I was looking at few other things.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Joshua Dickerson

That is not the last day of week 52. That is the first day of a new year. The way it is, is correct.
Come work with me at Promenade Group



Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

emanuele

Not really, as far as I can see around the internet and on my (KDE) calendar (see the attachments) where the 1st of January is considered part of the last week of the previous year (week 52), while the 2nd of January is in the 1st week of the year.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Thantos

Like all date and calendar issues it is regional.  But ISO 8601 does define how the weeks are counted.  And the first week is the week that contains the first Thursday.


<?php

$dates 
= array(
'Jan 1, 2007'// Monday
'Jan 1, 2008'// Tues
'Jan 1, 2014'// Wed
'Jan 1, 2009'// Thur
'Jan 1, 2010'// Fri
'Jan 1, 2011'// Sat
'Jan 1, 2012'// Sun
);

echo 
'
<ul>'
;

foreach (
$dates AS $date)
{
$ts strtotime($date);
echo '<li>'$date': 'date('N W'$ts), '</li>';  // N is the day of the week, W is the week number
}

echo 
'
</ul>'
;

Arantor

We had a long, long discussion about this internally. If you look, SMF's week calculation code was actually broken. First week of January 2012 showed some crazy stuff - where you could cause it to display week beginning Monday 2nd January as week 2.

I did some experimentation with using the ISO 8601 code, but with weeks beginning on Sunday this always looked wrong for US users, because it always ends up needing to display 'week numbers' on Mondays.

In the end, we concluded it was better to simply just remove that week number listing rather than trying to fix it because for a significant number of users it will look wrong even if it is correct. Especially because some people didn't (understandably) like the idea of showing 1st January 2012 as Week 52 even though it is week 52 of 2011 - because of how it would look confusing (even if correct), we just realised that just removing it was best.

For the weekly view, instead of saying 'Week x of y' it now says 'Week beginning December 26, 2011' or whatever would be appropriate.

Advertisement: