Advertisement:
NameCheap

Author Topic: Week 52 and 1 overlap when monday first day of the week  (Read 4266 times)

Hakala

  • Guest
Week 52 and 1 overlap when monday first day of the week
« on: March 27, 2012, 05:34:01 AM »
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

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,161
  • Gender: Male
  • THERE'S JUST ME
Re: Week 52 and 1 overlap when monday first day of the week
« Reply #1 on: March 27, 2012, 05:42:21 AM »
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

  • Guest
Re: Week 52 and 1 overlap when monday first day of the week
« Reply #2 on: March 27, 2012, 06:49:46 AM »
Hello Hakala and welcome to sm.org!
Thank you!

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.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,161
  • Gender: Male
  • THERE'S JUST ME
Re: Week 52 and 1 overlap when monday first day of the week
« Reply #3 on: March 27, 2012, 07:52:19 AM »
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

  • Guest
Re: Week 52 and 1 overlap when monday first day of the week
« Reply #4 on: March 27, 2012, 03:51:17 PM »
Could be something like that?

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

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,161
  • Gender: Male
  • THERE'S JUST ME


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

  • Guest
Re: Week 52 and 1 overlap when monday first day of the week
« Reply #6 on: March 27, 2012, 05:11:14 PM »
: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?

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,161
  • Gender: Male
  • THERE'S JUST ME
Re: Week 52 and 1 overlap when monday first day of the week
« Reply #7 on: March 29, 2012, 05:23:31 AM »
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.

Offline Joshua Dickerson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,666
  • Gender: Male
    • joshuaadickerson on LinkedIn
Re: Week 52 and 1 overlap when monday first day of the week
« Reply #8 on: April 17, 2012, 09:40:25 AM »
That is not the last day of week 52. That is the first day of a new year. The way it is, is correct.
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?

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,161
  • Gender: Male
  • THERE'S JUST ME
Re: Week 52 and 1 overlap when monday first day of the week
« Reply #9 on: April 18, 2012, 07:48:06 AM »
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.

Offline Thantos

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 16,150
  • Gender: Male
Re: Week 52 and 1 overlap when monday first day of the week
« Reply #10 on: April 18, 2012, 10:41:33 AM »
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.

Code: [Select]
<?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>'
;

Offline Arantor

  • SMF Friend
  • SMF Legend
  • *
  • Posts: 62,220
Re: Week 52 and 1 overlap when monday first day of the week
« Reply #11 on: January 27, 2014, 03:10:12 PM »
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.
And his eyes have all the seeming of a demon's that is dreaming,
And the lamp-light o'er him streaming throws his shadow on the floor