When creating or editing an event (node with cck-added date field) with starting and (optional) ending datetime value, where the end time is between 0:00(am) and 01:00(am), by choosing an hour value of 0 from the hour-dropdown box, this value is not used, but instead the hour value of the starting datetime is taken. It seems that an hour value of 0 in To-date is interpreted as an empty field and therefore overridden by Hour value of the From-date.
I included a small screenshot when editing the event. After saving these values the event has a duration of 24 hours in stead of just 1 hour.
A possible solution might be to have hours 1 to 24 in the dropdown box, although it seems more logical to correct this the code where the to-date field values are taken form the from-date field values.

Since I'm new to both drupal and php I have not yet found where or how to do this.

drupal-6.12
date-6.x-2.2
calendar-6.x-2.1
cck-6.x-2.2
views-6.x-2.5

Comments

rickmanelius’s picture

Same problem... saving an event as 0 hour sets some random time.

ronino’s picture

Version: 6.x-2.2 » 6.x-2.6
Component: Miscellaneous » Code
StatusFileSize
new636 bytes

I am surprised that a) so few people have this issue and b) "0" is considered an empty hour as until now I thought that 0 o'clock is a valid time ;-).

After struggling with this bug for hours, I traced it down to date_elements.inc, line 438

$merged_date[$part] = empty($value) ? $posted[$from_field][$part] : $value;

The problem is that empty('0') from the above code snippet is true for the hour and thus the fromdate hour is set whereas empty('00') from the minute is false and so "00" is kept. I suggest using trim($value) == '' instead to also allow "0" as the hour (which is of course the expected behavior). I attached a patch which fixes the issue for me in date module version 2.6.

damienmckenna’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Unfortunately the Drupal 6 version of the Date module is no longer supported. That said, we appreciate that you took time to work on this issue. Should this request still be relevant for Drupal 7 please feel free to reopen it. Thank you.