If you edit an event with hour- or minute values for start/end time values that are less then 10 (problem here: the leading zero) the select fields are set to "00" and the right option isn't set "selected". So after saving again the event the correct value is lost.

I fixed this issue by changing in event.module line 1506 to:
'#default_value' => (int) _event_date($hour_format, $timestamp, $offset),
and line 1512 to:
'#default_value' => (int) _event_date('i', $timestamp, $offset),

Just added the (int) so it works fine.

Comments

kidata’s picture

Seems to be the same issue like this one:
http://drupal.org/node/257850
the patch there worked for me.

smccabe’s picture

StatusFileSize
new979 bytes

Here is an actual patch if anyone wants. I'm not sure why this hasn't been pushed into a release yet, it is a very simple fix to a rather annoying problem. We have to run our own build of the event module in house and oh course we would prefer not to be forked.

edit: realized i forgot some info, this patch is for 5.x and it does work for both 24h and AM/PM

wdrout’s picture

StatusFileSize
new1.74 KB

Here's a patch that addresses this issue as well. It's for Drupal 6.x, and I took a slightly different approach. The patch above strips the zero from the default value. My patch adds a zero to the select tags that are < 10. This patch also addresses the same problem with the hour field in 12 hour am/pm mode.

smccabe’s picture

Version: 5.x-1.0 » 6.x-2.x-dev
StatusFileSize
new2.97 KB

This issue has been fixed in the newest version of 5.x-2.x

here is a modified version of wdrout's patch above that uses the same style of fix as in 5.x-2.x, but it also fixes some 12hr issues that wdrout had started fixing in the above patch as well. I only intended to fix the resetting issue but i noticed wdrout fixed a couple of 12hr am/pm related issues as well and looked deeper, turns out there are a few more 12hr issues but i believe this patch fixes all of them, it is rather large now though. The am/pm related issues appear to be in the 5.x-2.x branch as well but I'll wait till this patch gets approved before i make a version for that as well.

Also I'm not sure where exactly to post this, i think these fixes cover about 6-8 different issues posted as they can manifest in different ways and there seem to be dupe issues. Once this gets merged maybe we can close lots of issues off :)

dturover’s picture

Status: Reviewed & tested by the community » Needs review

smccabe: Thanks for the patch. That fixes almost everything that I've been dealing with except that "12:01" shows up as "12:1" in preview. [EDIT: I'm using 6.x from Jul-01.] It still saves to the DB correctly, so it is fixed where it's needed most.

Here is a list of duplicates that I've been tracking in case you want to consolidate these issues and direct people to the latest patch:
http://drupal.org/node/253188 "am/pm is only partially working"
http://drupal.org/node/278312 "Event Start Time Hour Resets to 00:00 when updating"
http://drupal.org/node/279876 "End date broken and events don't show on calendar after July 1 update"
http://drupal.org/node/290535 "Start date and time"

smccabe’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the thanks, and even more thanks for listing all those dupes, makes it easy for me to point them here. I'll take a look and fix that 12:1 issue as well and post an updated patch. Let me know if you have any other problems/requests for the patch. Once the patch is solid and/or gets commited i'll make a version for 5.x-2.x as I think most of the problems are present there as well, although the original time resetting bug I know has been fixed.

Cheers

killes@www.drop.org’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! I've applied the patch.

Marking the other issues duplicates.

smccabe’s picture

Status: Reviewed & tested by the community » Fixed

Cool, I'll backport a version of this patch to the 5.x-2.x branch when i get a chance.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.