From 872b9492db5c4ab3df59931b107cc6cf34886b9d Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Mon, 22 Jan 2024 14:47:40 +0100 Subject: [PATCH] fixed: all-day events --- ics.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ics.php b/ics.php index 7b5fccf..f01cfed 100644 --- a/ics.php +++ b/ics.php @@ -72,10 +72,12 @@ function ics2json(input) function dt(s) { - return new Date( - s.substr(0,4) + "-" + s.substr(4,2) + "-" + s.substr(6,2) - + "T" - + s.substr(9,2) + ":" + s.substr(11,2) + ":" + s.substr(13,2)); + var formatted = s.substr(0,4) + "-" + s.substr(4,2) + "-" + s.substr(6,2); + if (s.length > 8) + { + formatted += "T" + s.substr(9,2) + ":" + s.substr(11,2) + ":" + s.substr(13,2); + } + return new Date(formatted); } function formatdate(d)