[Koha-bugs] [Bug 5456] Create a link to opac-ics.pl

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jul 28 20:37:41 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5456

--- Comment #8 from Magnus Enger <magnus at libriotech.no> ---
First of all let me say that I am no iCal expert! 

I created a small test script:

---

#!/usr/bin/perl

use Modern::Perl;
use DateTime::Format::ICal;
use Koha::DateUtils;

my $datestring = '2016-03-10 23:59:00';

my $dt = dt_from_string( $datestring );
say DateTime::Format::ICal->format_datetime( $dt );

my $dt2 = dt_from_string( $datestring );
$dt2->set_time_zone( C4::Context->tz );
say DateTime::Format::ICal->format_datetime( $dt2 );

my $dt3 = dt_from_string( $datestring );
$dt3->set_time_zone( 'UTC' );
say DateTime::Format::ICal->format_datetime( $dt3 );

---

This gives the following output:

TZID=Europe/Oslo:20160310T235900
TZID=Europe/Oslo:20160310T235900
20160310T225900Z

I tested the output from Koha in a couple of different validators. When I have
a date like TZID=Europe/Oslo:20160310T235900 in the ICS I get errors from the
validators: 

Error: Error was: Error at line 15:[DTSTART] Unparseable date:
"TZID=Europe/Oslo:20160810T235900"
Cause: Caused by: [DTSTART] Unparseable date:
"TZID=Europe/Oslo:20160810T235900"
http://severinghaus.org/projects/icv/

Invalid DTSTART value, must be a date or date-time value near line # 11
http://icalendar.org/validator.html

When I change the script so all dates look like 20160310T225900Z, I get no
errors from the same validators. In addition, Marc has said that Thunderbird
accepts this (but not TZID=Europe/Oslo:20160310T235900) *and* interprets the
date and time correctly. My pragmatic side tells me this should be good enough.
:-)

>From https://metacpan.org/pod/DateTime::Format::ICal:
"The iCal spec requires that datetimes be formatted either as floating times
(no time zone), UTC (with a 'Z' suffix) or with a time zone id at the beginning
('TZID=America/Chicago;...')."

The way I read this, "formatting as UTC" is just as good as having a "time zone
id at the beginning".

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list