aboutsummaryrefslogtreecommitdiffstats
path: root/functions/parse
diff options
context:
space:
mode:
authorJim Hu <jimhu@users.sourceforge.net>2008-12-26 16:59:10 +0000
committerJim Hu <jimhu@users.sourceforge.net>2008-12-26 16:59:10 +0000
commita02ca8fd76dfa6b0f280780f76fb9bfce5a9fd36 (patch)
treecd5c150b2490fdcb9503f4aa581dff868cf9170b /functions/parse
parentae9ce41d6df68ed6449f296dd8af48590d27157d (diff)
downloadphpicalendar-a02ca8fd76dfa6b0f280780f76fb9bfce5a9fd36.tar.gz
phpicalendar-a02ca8fd76dfa6b0f280780f76fb9bfce5a9fd36.tar.bz2
phpicalendar-a02ca8fd76dfa6b0f280780f76fb9bfce5a9fd36.zip
eliminate negative event lengths and adjust display lengths for short events
Diffstat (limited to 'functions/parse')
-rw-r--r--functions/parse/end_vevent.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php
index 4c5c352..3f14924 100644
--- a/functions/parse/end_vevent.php
+++ b/functions/parse/end_vevent.php
@@ -48,7 +48,12 @@ if (isset($start_time) && isset($end_time)) {
$allday_end = ($start_date + 1);
}
}
-
+# disallow events with negative length
+if ($end_unixtime < $start_unixtime){
+ $end_date = $start_date;
+ $end_time = $start_time;
+ $end_unixtime = $start_unixtime;
+}
# look for events that span more than one day
if (isset($start_unixtime,$end_unixtime) && date('Ymd',$start_unixtime) != date('Ymd',$end_unixtime)) {
$spans_day = true;
@@ -63,9 +68,9 @@ if (isset($start_time) && $start_time != '') {
preg_match ('/([0-9]{2})([0-9]{2})/', $start_time, $time);
preg_match ('/([0-9]{2})([0-9]{2})/', $end_time, $time2);
if (isset($start_unixtime) && isset($end_unixtime)) {
- $length = $end_unixtime - $start_unixtime;
+ $length = $end_unixtime - $start_unixtime;
} else {
- $length = ($time2[1]*60+$time2[2]) - ($time[1]*60+$time[2]);
+ $length = ($time2[1]*60+$time2[2]) - ($time[1]*60+$time[2]);
}
$drawKey = drawEventTimes($start_time, $end_time);

© 2014-2024 Faster IT GmbH | imprint | privacy policy