Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
This is my first bug report here, so I may be reporting incorrectly.
The issue I have is this: once user clicks on the Year view of a calendar, then when they click on Month or Week or Day, they are not taken to the current month, week, day, but instead they are taken to the last week of the year.
So if the year view shows 2009, Month links to /2009-12, week links to /2009-W50 and day links to /2009-12-09.
Comment | File | Size | Author |
---|---|---|---|
#16 | theme.inc_.patch | 7.76 KB | marcushenningsen |
#14 | calendar week display month link is current not relative screenshot.gif | 32.75 KB | _vid |
#6 | theme.inc_.patch | 617 bytes | arnd |
Comments
Comment #1
Andrew Schulman CreditAttribution: Andrew Schulman commentedsubscribing
Comment #2
pmusaraj CreditAttribution: pmusaraj commentedJust an update for this issue:
Would the fact that I'm using the Date API with PHP 5.0.1 (and the Date PHP4 module that translates some functions) be a factor? Does this affect the Year, Month, Day links?
Also of note, I'm using now the dev version of Views now, and the issue persists.
Comment #3
arnd CreditAttribution: arnd commentedsubscribing
Comment #4
pmusaraj CreditAttribution: pmusaraj commentedUntil this gets fixed, I'm implementing a very very short hack. On calendar/theme/theme.inc line 24 I am replacing :
$view->date_info->month = $view->date_info->month && $view->date_info->month != $view->argument['date_argument']->options['wildcard'] ? $view->date_info->month : date_format($now, 'm');
with
$view->date_info->month = date_format($now, 'm');
My line just picks today's date at all times, as the value to be used for the month, year, day, navigation links. It picks current month, and then appends it to the year value of the argument.
Again, this is a hack, and it shouldn't be done, but it helps when you're in a pinch.
Comment #5
pmusaraj CreditAttribution: pmusaraj commentedComment #6
arnd CreditAttribution: arnd commentedThis patch is meant to show the reason for the problem. It is certainly not a good solution. including the prev and next links into testing and browse through the year/month/week hierarchy one can find more trouble.
Comment #7
leelanorton CreditAttribution: leelanorton commentedI need a fix that can be used on a live commercial site.
Comment #8
NikLP CreditAttribution: NikLP commentedMarking this fixed because I'm pretty sure it is. Suggest updating to latest release of course. Works for me in 2.2+
Comment #10
jimboh CreditAttribution: jimboh commentedI have just implemented latest date+calendar (6.x-2.x-dev) on drupal 6.14.
I have this problem.
On entering Calendar page with year view showing 2010. Current date = 2010-01-26 (strong is wrong)
year link is 2010, monthlink is 2010-12 weeklink is 2010-W53 and daylink is 2010-12-26
Update: on further investigation, the links appear to be pretty wierd.
On first entry to the page or if the year link is chosen, its as above.
If click on a date to navigate to day view, the day, week and month links are correct
eg click on 19th May - display is day of may19 -
yearlink is 2010, monthlink is 2010-05 weeklink is 2010-W21 and daylink is 2010-05-19
then click on weeklink -
yearlink is 2010, monthlink is 2010-01 weeklink is 2010-W21 and daylink is 2010-01-26
then click on monthlink - display is Jan
all links are now correct for current date
it will not maintain day/week/month sync
Comment #11
marcushenningsen CreditAttribution: marcushenningsen commentedThis is still an issue with version 2.2. I investigated the issue thouroughly, which didn't make it less complicated, but here are my results:
(current date: 2010-03-04)
(chosen date: 2011-07-15 (W28)
Day view:
Week view:
Month view: 2011-07
Year view: 2011
Now, before digging into the code, I suggest that we (needless to say, in collaboration with the maintainer) agree on what is in fact expected behaviour. The added paranthesis are my ideas of expected and unexpected behaviour, but this of course is due to discussion.
Looking forward to hearing your comments...
Marcus
Comment #12
marcushenningsen CreditAttribution: marcushenningsen commentedSorry, bad version tag.
Comment #13
Gribnif CreditAttribution: Gribnif commentedMy opinions:
Comment #14
_vid CreditAttribution: _vid commentedI had the same issue in 6.x-2.2 and updated to dev. Still having the issue.
I noticed it in week view. As stated above the year is correct but the month is the current month. Attached a screenshot.
I agree with marcushenningsen on week view's month link expected behavior.
In fact all recommendations in bold look good.
Comment #15
jenyum CreditAttribution: jenyum commentedsubscribing. Need a fix for a commercial site.
Edited to say: if we could just get a fix for the year to day link I think that would do the trick. Some of the other behavior might not be what everyone would expect but it does at least make sense.
Comment #16
marcushenningsen CreditAttribution: marcushenningsen commentedPatch attached. Changes according to most of my proposals above, futher explanations can be found in the patch. I've tested it thouroughly, but I'd appreciate if someone else could please review this, too.
Comment #17
janwalhof CreditAttribution: janwalhof commentedHello Marcus,
I use drupal 6.16 and Calendar 6x-2.2.
I have tested your patch today with the date april 17th 2010.
Things are better now except for the display of the week. Your patch calculates week 15 with the day-indicator 4th april 2010. Week 15 is correct, in case that week 1, this year, started on the 3th of januari. The day-indicator of the week, 4th of april 2010, is not correct. It should be the 11th of april 2010.
I solved this by changing your statement:
+ $current_week = date_format($now, 'W');
by
+ $current_week = date_format($now, 'W')+1;
I'm not sure this will still work correct in all circumstances.
Regards,
Jan Walhof
Comment #18
RedTop CreditAttribution: RedTop commentedThanks guys,
I'm using Drupal 6.16, calendar 6.x-2.2, date 6.x-2.4. Patch seems to work well. I've added Jan's modification.
Comment #19
shark CreditAttribution: shark commentedsubscribing
Comment #20
gollyg CreditAttribution: gollyg commentedI don't think that #18 is correct - I believe that the issue is that the php week function always uses ISO week numbers, whereas the date module can be configured to use ISO or non-ISO (it is non-ISO by default). Rather than changing the week number, it would be better to change your ISO date configuration at mysite.com/admin/settings/date-time. It seems optimistic that adding 1 to the ISO week number will work in all cases - I imagine it just happens to be correct in 2010.
I guess the patch should really check the status of this ISO setting via the variable date_api_use_iso8601 and apply any modifications as necessary, although I am unsure as to how non-ISO week numbers are calculated? I am guessing that week one is the week with the 1st of January. If this is the case I can create a patch to adjust this conditionally.
Comment #21
beauz CreditAttribution: beauz commentedI've just had a similar problem, make sure you check the granularity on the default argument. It should be day and not year.
Comment #22
squiggy CreditAttribution: squiggy commented@beauz, thank you for posting the tip. That fixed this for me with drupal 6.22, date 6.x-2.7 and calendar 6.x-2.4.
Comment #23
manos_ws CreditAttribution: manos_ws commentedIn which view should the granularity should be fixed ?
I had the problem in the month link when the user is at the year view and I fixed it by patching the file
calendar_multiday\theme\theme.inc
Comment #24
squiggy CreditAttribution: squiggy commentedI was mistaken in my last comment. But #18 did help fix this issue for me.
Comment #25
fullerja CreditAttribution: fullerja commentedI am having this issue as well. I tried to apply the patch in #16. But I get "HUNK #1 failed at 27."
I would really appreciate any advice.
Comment #26
dkinzer CreditAttribution: dkinzer commentedThe granularity bit did not work for me. But I applied patch at #16 #396152-16: Navigation links (Month, week, and day) sometimes incorrect and it works perfectly for me.
Comment #27
dkinzer CreditAttribution: dkinzer commentedComment #28
dkinzer CreditAttribution: dkinzer commentedComment #29
PROMESI discovered some problems today with start/end of the year. My weeks start on monday.
The results are very confusing for visitors and myself as well.
When I go to week view 2012-W52 (2012-12-24 to 2012-12-30):
Next week = 2012-W1 => should be 2013-W1
In day view 2012-12-31 the weeknumber is 2012-W01
When I go to week view 2013-W1 (2012-12-31 to 2013-01-06):
The year tab is: 2013: correct if based on the weeknumber, wrong when based on the first day of the week
The month tab is: 2013-12 => should be 2012-12 (based on the first day of the week, otherwise 2013-01)
The day tab is: 2013-12-31 => should be, of course, 2012-12-31.
When I apply patch #16 + addendum #17:
Same results.
On what day of the week / date the year, week and day numbers are calculated?
On end of the year it seems to be: first day of the week (like week view 2013-W1: based on monday 2012-12-31)
On start of a month: first day of the month (like month view 2013-01: based on tuesday 2013-01-01; monday 2012-12-31 = grey: not in view)
Comment #30
smurfxx CreditAttribution: smurfxx commentedI have the same issue with the latest version, in the month view the "Next month" link adds always 2 months instead of 1
Comment #31
vcouver CreditAttribution: vcouver commented@smurfxx : "in the month view the "Next month" link adds always 2 months instead of 1"
The bug is in the Date module.
A fix is listed. See https://www.drupal.org/node/2658274 comment #3
Comment #32
izmeez CreditAttribution: izmeez commentedAs described in #31 I think this is fixed and cannot reproduce it. I am going to close this as a duplicate of #2658274: Error with Next button in Month View: only 7 months.