Events do get saved in the database, but there' s a problem when you chose times like 12:15 pm.

Also, the output is not always am/pm..

Saving and displaying the am/pm times needs to be fixed to work as explained here:

http://en.wikipedia.org/wiki/12-hour_clock

Comments

dturover’s picture

I had a similar problem where times at hour 12 were not handled as afternoon times should be. For an event from 12:00 noon to 1:00 pm, the event module added 12 hours to the starting time and then reset the ending time to the starting time since 13:00 comes before 24:00.

I rewrote case presave so it does not mistakenly add 12 hours to afternoon events, and rearranged it so that the conversion to 24-hour format is made before the event_is_later() comparison requiring this conversion is ran. This lets the time be saved to the database correctly but it does not fix a separate issue I had of the times displaying oddly in preview (as "12:00" and "1:00" without "am" or "pm").

I do not know how to submit a patch, but you can replace the code around line 2278 with this:

      case 'presave':
        if (variable_get('event_ampm', '0') == 1) {
          if ($node->event['start_exploded']['ampm'] == 'pm') {
            if($node->event['start_exploded']['hour'] < 12){
              $node->event['start_exploded']['hour'] += 12;
            }
          }
          if ($node->event['end_exploded']['ampm'] == 'pm') {
            if($node->event['end_exploded']['hour'] < 12){
            $node->event['end_exploded']['hour'] += 12;
            }
          }
        }
        if (event_is_later($node->event['start_exploded'], $node->event['end_exploded'], 'array')) {
          $node->event['end_exploded'] = $node->event['start_exploded'];
        }
        $node->event['start_in_dst'] = event_is_dst($node->event['timezone'], $node->event['start_exploded']);
        $node->event['end_in_dst'] = event_is_dst($node->event['timezone'], $node->event['end_exploded']);
        break;
killes@www.drop.org’s picture

Status: Active » Closed (duplicate)