Advertisement:

Author Topic: [Bug] Calendar Week Number  (Read 4961 times)

Offline Sverre

  • Beta Tester
  • Sr. Member
  • *
  • Posts: 748
[Bug] Calendar Week Number
« on: November 05, 2006, 03:47:35 PM »
I mentioned this in the release thread of one of the previous release candidates, but the problem is still present in RC3 and DE, so it might have been overlooked.

If you have Monday or Saturday selected as the first day of the week, the displayed week number in the calendar is wrong (+1).

Offline Luktar

  • Semi-Newbie
  • *
  • Posts: 13
Re: [Bug] Calendar Week Number
« Reply #1 on: November 28, 2006, 04:25:12 AM »
Bump, any news about this?

can also be refered to http://www.simplemachines.org/community/index.php?topic=89850.0

i have this problem to, have monday as first day in week and weeknr is +1 to mutch.

Offline Daniel Hofverberg

  • Senior Translator
  • Sr. Member
  • *
  • Posts: 980
  • Gender: Male
    • Dubbningshemsidan
Re: [Bug] Calendar Week Number
« Reply #2 on: November 28, 2006, 05:16:12 AM »
I've checked on my forum, and the week number was definitely off there too - so this does indeed seem to be a bug.

Can anything be done about this ASAP, preferably in 1.1 Final?

Offline Daniel Hofverberg

  • Senior Translator
  • Sr. Member
  • *
  • Posts: 980
  • Gender: Male
    • Dubbningshemsidan
Re: [Bug] Calendar Week Number
« Reply #3 on: December 18, 2006, 06:11:31 AM »
I have studied the code in Calendar.php extensively the last week, in order to try and fix this problem - but it seems to be a little over my head, and despite a lot of work I didn't manage to get the week numbers to display correctly.

Obviously, SMF only supports the week number definition that the week containing January 1st is the first week of the year, and there is no option to change week number standard. But many European countries (such as the UK, Germany, Scandinavia, etc) define week number 1 as the first week containing at least four days of the current year (I e '%V' in PHPs strftime).

Unfortunately, it isn't quite as simple as just changing '%w' to '%V', as the addition of week numbers for the other weeks in the month (as the week number is only calculated once, and then +1 is used) is screwed up when it reaches the new year.

Can someone more experienced with SMF and Calendar.php please look into this problem, and make a quick fix to change week numbers to the European standard (I e the ISO-8601 standard, which is explained under '%V' in PHPs documentation for strftime)?

SMF really should add an option for the different week number definitions in the next version, but while waiting for that, most of us in Europe would appreciate a quick fix to show the correct ISO-8601 week numbers in the calendar. It can't be that hard...

Offline nitins60

  • Sr. Member
  • ****
  • Posts: 838
  • Gender: Male
  • LoVE mAKeS lIFe bEauTIfUL
    • Simple Mobile Forum - SMF
Re: [Bug] Calendar Week Number
« Reply #4 on: December 18, 2006, 06:47:44 AM »
Something tricky!

Offline Daniel Hofverberg

  • Senior Translator
  • Sr. Member
  • *
  • Posts: 980
  • Gender: Male
    • Dubbningshemsidan
Re: [Bug] Calendar Week Number
« Reply #5 on: January 11, 2007, 05:16:35 AM »
I hate to bump the topic, but can't anyone more experienced than I am take a look at this, and make a quick fix to display week numbers according to European standard (ISO-8601, strftime's %V option)?

I don't think it should be too complicated, for anyone who knows what they are doing...

Offline PSi

  • Newbie
  • *
  • Posts: 3
Re: [Bug] Calendar Week Number
« Reply #6 on: June 30, 2011, 12:38:29 AM »
Has this issue being solved?

MySQL has provided the "week()" with enough (?) options at least since version 5.0:

  dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_week.

Perhaps the Calendar module could be converted to make use of this feature of MySQL?

pekka

Offline Aleksi "Lex" Kilpinen

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,444
  • Gender: Male
  • The Artist Formerly Known as LexArma
Re: [Bug] Calendar Week Number
« Reply #7 on: June 30, 2011, 01:12:38 AM »
Well, this particular discussion was back in the days of 1.1... So Most probably it has been fixed or worked around later on...
Finnish Support Local Moderator & Support Specialist
My Mods: Facebook and Twitter Sharer



Offline PSi

  • Newbie
  • *
  • Posts: 3
Re: [Bug] Calendar Week Number
« Reply #8 on: September 01, 2011, 03:50:22 PM »
I'm just a plain vanilla member of BBS having SMF 1.1.12 and would like to find out if this is really fixed.

The documentation page:


mentions only the setting of "first day of the week", but not the definition of the first week of the year. From this I take it that the issue is still unsolved. The first day of the week setting was already in SMF 1.1.12.

Aren't there any users of the later versions here so that they could verify that the feature indeed exists in later versions?

pekka

Offline Daniel Hofverberg

  • Senior Translator
  • Sr. Member
  • *
  • Posts: 980
  • Gender: Male
    • Dubbningshemsidan
Re: [Bug] Calendar Week Number
« Reply #9 on: September 01, 2011, 04:19:44 PM »
I have checked my forum running SMF 2.0 Final, and the week numbers listed there are correct for the ISO-8601 standard used in most European countries; I e week number 1 is the week containing at least 4 days of the new year.

I can't seem to find an option to choose week numbering standard though, so I'm not exactly sure how SMF chooses what standard to use. I get the same week numbers for both Swedish and English language on my forum. I also get the same week numbers on this forum; I e week 35 right now.
« Last Edit: September 01, 2011, 04:24:00 PM by Daniel Hofverberg »

Offline PSi

  • Newbie
  • *
  • Posts: 3
Re: [Bug] Calendar Week Number
« Reply #10 on: September 02, 2011, 12:27:59 PM »
Thanks!

I must start teasing the administrator of the BBS in question :)

pekka

Offline mcjanne

  • Newbie
  • *
  • Posts: 5
Re: [Bug] Calendar Week Number
« Reply #11 on: February 13, 2012, 09:13:14 AM »
I seem to have this problem, hjeleb?

Win7 Pro
Apache/2.2.21 (Win32) PHP/5.3.3
MySQL 5.5

SMF 2.0.2

Offline Illori

  • Doc Writer
  • SMF Master
  • *
  • Posts: 25,812
Re: [Bug] Calendar Week Number
« Reply #12 on: February 13, 2012, 09:49:09 AM »
you would be best to start your own thread and not bump old threads.

Offline emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,884
  • Gender: Male
  • Because Orange is Orange
Re: [Bug] Calendar Week Number
« Reply #13 on: February 13, 2012, 06:48:52 PM »
Oh well, while we are at it and since I remember another report on that, there is still something strange going on... I think (I'm not good with the calendars).

http://www.simplemachines.org/community/index.php?action=calendar;viewweek;year=2012;month=1;day=1

Should be the first day of the year, so week 1 or..52?
Sunday 1st day of the week I get week 2
Saturday 1st day of the week I get week 53
Monday 1st day of the week I get week 53

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 mcjanne

  • Newbie
  • *
  • Posts: 5
Re: [Bug] Calendar Week Number
« Reply #14 on: February 15, 2012, 04:13:48 AM »
Well, since it seems this topic is still open, I figured it would be wise to enable follow ups from the past.

My bad.