Subject: | Retain VALUE=DATE property |
When DTSTART (DTEND, ...) has a VALUE=DATE property and a date as value, this property gets lost when parsed.
For example:
DTSTART;VALUE=DATE:20180618
After parsing, re-assignment and stringification, this becomes
DTSTART;TZID=floating:20180618000000
Is there a way to construct a DateTime object so, that
$event->start( DateTime->new( ??? ) );
will stringify to DTSTART;VALUE=DATE:...
Subject: | t.pl |
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use local::lib qw(.);
use Data::ICal;
use Data::ICal::DateTime;
my $c = Data::ICal->new( data => <<EOD );
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//PIMUTILS.ORG//NONSGML khal / icalendar //EN
BEGIN:VEVENT
DTEND;VALUE=DATE-TIME:20180620T194041
DTSTAMP;VALUE=DATE-TIME:20180616T210146Z
DTSTART;VALUE=DATE:20180619
UID:1
END:VEVENT
END:VCALENDAR
EOD
my $e = $c->entries->[0];
# Re-set from original.
$e->start( $e->start );
$e->end( $e->end );
# Dates are now floating timestamps.
print( $e->as_string, "\n" );