News:

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

Main Menu

[Bug] Calendar Week Number

Started by Sverre, November 05, 2006, 03:47:35 PM

Previous topic - Next topic

Sverre

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).

Luktar

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.

Daniel Hofverberg

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?

Daniel Hofverberg

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...

nitins60


Daniel Hofverberg

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...

PSi

Has this issue being solved?

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

  hxxp:dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_week [nonactive].

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

pekka

Aleksi "Lex" Kilpinen

Well, this particular discussion was back in the days of 1.1... So Most probably it has been fixed or worked around later on...
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

PSi

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

Daniel Hofverberg

#9
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.

PSi

Thanks!

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

pekka

mcjanne

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

Illori

you would be best to start your own thread and not bump old threads.

emanuele

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


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.

mcjanne

Well, since it seems this topic is still open, I figured it would be wise to enable follow ups from the past.

My bad.

Advertisement: