Advertisement:

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

Offline Hakala

  • Newbie
  • *
  • Posts: 4
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

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,819
  • Gender: Male
  • Because Orange is Orange
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.

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 Hakala

  • Newbie
  • *
  • Posts: 4
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

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,819
  • Gender: Male
  • Because Orange is Orange
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?

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 Hakala

  • Newbie
  • *
  • Posts: 4
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

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,819
  • Gender: Male
  • Because Orange is Orange

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 Hakala

  • Newbie
  • *
  • Posts: 4
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

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,819
  • Gender: Male
  • Because Orange is Orange
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.

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

  • Developer
  • SMF Super Hero
  • *
  • Posts: 12,618
  • 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.
Joshua Dickerson
Developer

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

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,819
  • Gender: Male
  • Because Orange is Orange
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.

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,136
  • 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>'
;