For some reason the week number ("W" in the php date format) gets printed twice sometimes when it's rendered.
The date string displays well in the date format list, but the week gets repeated in both CCK node display and Views lists.
Strings I've tried so far are:
* "W"
* "W."
* " W"
* "W "
Surprisingly, the string "l v\e\ck\a W" renders well, but the following gets the week rendered twice:
* "v\e\ck\a W"
* "v\e\ck\a W (Y)" <-- rendering to "vecka 12 (2010) vecka 12"!
I have no idea what's going on here, but I thought I should report a bug.
My system:
Pressflow/Drupal 6.16
Date 6.x-2.4
CCK 6.x-2.6
Views 6.x-2.8
Tried on Garland and a customized version of Zen 6.x-1.1.
Comment | File | Size | Author |
---|---|---|---|
#11 | date-week-format-repeat-752550-11.patch | 513 bytes | fonant |
7-double rendering in composite format.png | 7.13 KB | Itangalo | |
6-output in views.png | 26.25 KB | Itangalo | |
5-output on node.png | 11.01 KB | Itangalo | |
4-display settings.png | 45.27 KB | Itangalo |
Comments
Comment #1
Itangalo CreditAttribution: Itangalo commentedSome more information about the system:
* Apache
* PHP: 5.2.4-2ubuntu5.10
* MySQL database: 5.0.51a
Comment #2
Dennis Söderström CreditAttribution: Dennis Söderström commentedSame here.
Drupal: 6.1.7
Views: 6.x-2.11
Comment #3
petermilad CreditAttribution: petermilad commented+1
Same here too
Comment #4
Tino CreditAttribution: Tino commentedSame here! Very strange. A little frustrating... :-(
Comment #5
AdamEvertsson CreditAttribution: AdamEvertsson commentedDito. Quite irritating....
Drupal 6.19
Views 6.x-2.11
Comment #6
ollu CreditAttribution: ollu commentedI would like to use the week format for a client and have scanned the internet for a solution with no luck. So if someone has come up with a solution I'm eager to find out.
Comment #7
spacer CreditAttribution: spacer commentedSame problem. I've also found that the PHP date 'z' option for the day of year (0-365) is also repeated twice and can't be used in views lists - which is a shame as it would be useful for displaying/sorting events that occur days apart over the course of a year.
Comment #8
JockeL CreditAttribution: JockeL commentedSame problem. Anyone found a solution or workaround for this?
Comment #9
Itangalo CreditAttribution: Itangalo commented@JockeL: Haven't found any solution, and I've been talking to at least one colleague who also haven't found any solution (or understood where this bug comes from). :-(
Comment #10
fonant CreditAttribution: fonant commented+1 Most odd! I get this too. Very annoying...
OK, found the problem.
In the date_limit_format() function the system tries to remove everything that isn't a timezone specifier, for formatting the timezone string. But the "W" for week number and some other day-related date() codes aren't removed. So the week number is formatted as the timezone string, and so is printed out twice: once as the formatted date, and once as the timezone string.
I've fixed the problem by changing the regexp for
case 'day':
in date_limit_format(), around line 1658 from this:to this, which includes the other day-related date() codes including the one for "week number":
This removes those characters from the timezone format string as well.
Comment #11
fonant CreditAttribution: fonant commentedHere's a patch for it.
Comment #12
Itangalo CreditAttribution: Itangalo commented@Fonant: Impressive bug hunting! Patch is much appreciated -- looking forward to testing it.
Comment #13
sokru CreditAttribution: sokru commentedtestaed patch #11 and worked fine. Thanks!
Comment #14
tancPatch at #11 works nicely. Thanks!
Comment #15
Itangalo CreditAttribution: Itangalo commentedComment #16
arlinsandbulte CreditAttribution: arlinsandbulte commentedThe code was the same in 7.x-2.x-dev, so I applied the same change there too.
D6 Commit:
http://drupalcode.org/project/date.git/commit/b1cef68
D7 Commit:
http://drupalcode.org/project/date.git/commit/3c8b372
Thanks