[dev] Kronolith bug - event at 11am and 11pm (12h format)

Joel Vandal jvandal@subi.to
Sun, 28 Jul 2002 17:04:08 -0400


I have just noticed a problem at the time of the addition from event when
the date is in format am/pm.

The problem occurs if a value is present in timestamp (addevent.php) and
that the start hour is 11h am or 11h pm

The event is visible in month view but not in those for the week or the day.

Here is a little patch that solve this problem...

--
Joel Vandal


==================== CUT ====================

RCS file: /repository/kronolith/templates/edit/edit.inc,v
retrieving revision 1.57
diff -c -r1.57 edit.inc
*** templates/edit/edit.inc 15 Jun 2002 05:04:20 -0000 1.57
--- templates/edit/edit.inc 28 Jul 2002 20:47:52 -0000
***************
*** 143,149 ****
    <?php echo $event->html('end_hour') ?>&nbsp;:&nbsp;<?php echo
$event->html('end_min') ?>
    <?php
    if (!$prefs->getValue('twentyFour')) {
!       if ($event->getEndDate('a') == 'am') {
            $am = ' checked="checked"';
            $pm = '';
        } else {
--- 143,149 ----
    <?php echo $event->html('end_hour') ?>&nbsp;:&nbsp;<?php echo
$event->html('end_min') ?>
    <?php
    if (!$prefs->getValue('twentyFour')) {
!       if ($event->getEndDate('H') < 11) {
            $am = ' checked="checked"';
            $pm = '';
        } else {
Index: templates/edit/javascript.inc
===================================================================
RCS file: /repository/kronolith/templates/edit/javascript.inc,v
retrieving revision 1.13
diff -c -r1.13 javascript.inc
*** templates/edit/javascript.inc 15 Jun 2002 05:04:20 -0000 1.13
--- templates/edit/javascript.inc 28 Jul 2002 20:47:52 -0000
***************
*** 124,130 ****
      }
      var endHour =
parseInt(form.end_hour[form.end_hour.selectedIndex].value);
      if (form.end_am_pm[1].checked) {
!         endHour += 12;
      } else if (endHour == 12) {
          endHour = 0;
      }
--- 124,132 ----
      }
      var endHour =
parseInt(form.end_hour[form.end_hour.selectedIndex].value);
      if (form.end_am_pm[1].checked) {
!         if (endHour != 11 && endHour != 12) {
!         endHour += 12;
!         }
      } else if (endHour == 12) {
          endHour = 0;
      }