After creating an event, editing the event causes the hour select to reset to 00. Should be set to the hour saved for the event. See screen shot attached.

CommentFileSizeAuthor
#6 default_value_hour_minute.patch806 bytesdingbats
Screenshot.png144.14 KBhowertko

Comments

co_photobug’s picture

This is happening when editing my events, too. I am using Drupal 5.5 and Events 5.x-1.0.

Patrick Nelson’s picture

Happens with mine too. Using Drupal 5.7 and event.module 1.215.2.16 (5.x-1.x-dev dated 2007-Sep-09)

Regards

Patrick

Patrick Nelson’s picture

Further info -> This only happens when the settings are set to 24h (as opposed to 12h) in Event > Timezone Handling (/admin/settings/event/timezone)

Regards

Patrick

cmillet1’s picture

I'm having this problem as well. Changing to 12hr format "fixed" it for me, but still wondering if there's been resolutions to this.

yas’s picture

subscribing

dingbats’s picture

Component: Basic Event » Code
Status: Active » Needs review
StatusFileSize
new806 bytes

The #default_value returned from _event_date() is a two-digit string, when the form renderer expects a number. In the form rendering process PHP coerces the string into a number, which means strings "01" to "09" become the number 0. For example, if you set the hour to "01", "01" (string) is coerced into 0 (int); however, "10" (string) becomes 10 (int), so hours 10 or larger are unaffected.

This effect can be observed in the minute field too.

Please review the attached patch which corrects this issue.

EDIT: Sorry, it had nothing to do with type coercion, but it is in the form rendering process, specifically form.inc#form_select_options():

// File includes/form.inc, line 960
$key = (string)key;
if ($value_valid && (!$value_is_array && (string)$element['#value'] === $key || ($value_is_array && in_array($key, $element['#value'])))) {

The important section is (string)$element['#value'] === $key, which is comparing "01" === "1".

japerry’s picture

Status: Needs review » Closed (outdated)

Event for Drupal 8 is unrelated to older versions. If an issue similar to this one exists, please open a new issue with the 8.x branch.