Days in the calendar are incorrectly marked as "today" (with a CSS class name) when the date matches, but the month or year doesn't. This makes the 23rd (today) show highlighted for every month in the calendar.

CommentFileSizeAuthor
#8 event.css.today.patch460 bytesdarren oh

Comments

stelman’s picture

Verified bug. I just stumbled across this same issue.

darren oh’s picture

Component: User interface » API

I believe this is due to line 501 of event.module (function event_calendar_month):

'class' => strtolower("$month_name ". $weekdays[$x]['day'] . ($curstamp == $today ? ' today' : '') . ($cur_day == $day ? ' selected' : '')),

It appears to check for the current day without checking the month or year. I hope there is a patch for this soon.

pwolanin’s picture

This doesn't seem to happen for me when using the 4.7 version of the code. Was this changed in the CVS version?

A related issue of "Today" being advanced too soon is here:

http://drupal.org/node/65210

darren oh’s picture

Title: Calendar days are marked as "today" incorrectly » Can't Display Month Without Selecting Day
Version: 5.x-2.x-dev » 4.7.x-1.x-dev

Actually, this is now the 4.7 version. I don't think it's related to the issue of the date being advanced too soon. To reproduce this bug, look at months other than the current month. You will see that every day with the same number as today is highlighted.

You can see examples here:

July http://lakelandsda.org/event/2006/07/21/month/all/all/1
August http://lakelandsda.org/event/2006/08/21/month/all/all/1

Looking at the URL, occurred to me that it is the day given in the URL that is highlighted. I was able to confirm this by typing days in the URL. Whatever day is in the URL is highlighted.

This means that the problem is with the links for next and previous months. Maybe the event API lacks a method to call up a month without specifying a day.

pwolanin’s picture

Ok, but this doesn't happen for me:

http://www.princetondems.org/event/2006/07/21/month/all/all/1

http://www.princetondems.org/event/2006/08/21/month/all/all/1

using this version:

// $Id: event.module,v 1.183.2.6 2006/05/22 13:54:07 killes Exp $

darren oh’s picture

I'm using exactly the same version of event.module. Your calendar looks completely different from mine. Are you using a custom calendar theme?

pwolanin’s picture

Yes, we have customized the CSS and some of the theme functions for a cleaner display. However, this shouldn't affect the underlying code in event.module.

Actually, the difference may be at the CSS level. Here's a comparison of the page source for this month vs. next month:

</td><td class="jul fri today selected" id="jul21"><div class="day">21</div>
</td><td class="aug mon selected" id="aug21"><div class="day">21</div>

note that both are "selected", but only the first is "today".

here's the CSS we're using:

.event-calendar td.today {
  background: #FFE9E9 url(../../images/today.gif) no-repeat center bottom;
}

The original CSS file has these two directives:

.event-calendar td.today {
  background: #f99;
}
.event-calendar td.selected {
  background: #99f;
}

So it seems that the real bug is in the application of or styling for the "selected" attribute, not for the "today" attribute.

darren oh’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new460 bytes

Thanks for such a quick solution. The problem was that the styling for the selected day came after the styling for today, making them look alike. This patch puts them in the correct order.

killes@www.drop.org’s picture

I don't mind to commit the patch, but I fail to see why it would fix any problem. Can somebody with more CSS understanding than me explain this?

darren oh’s picture

Title: Can't Display Month Without Selecting Day » Can't View Highlighting of Today's Date
Component: API » User interface

Users cannot be sure they are viewing the current month unless they already know the date. Here is the problem: When one views the calendar, today's date is selected and appears with a blue background. When one advances to the next month, the same day of the month is selected and shows a blue background.

This confuses users who assume (as I and others in this thread did) that the blue background highlights today's date. The truth is that today's date is highlighted in red. The user will never see that without modifying the URL to select a different date, because the color of the selected date covers up the color of today's date.

The patch in #8 eliminates this confusion by preventing the selected date color from covering up today's date color.

killes@www.drop.org’s picture

Status: Reviewed & tested by the community » Fixed

applied

darren oh’s picture

Much appreciated, killes!

darren oh’s picture

Status: Fixed » Reviewed & tested by the community

Can we get this committed to the 4.7 branch?

darren oh’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Opened issue 79197 to request fixes to be backported to 4.7.