Skip Menu |
 

This queue is for tickets about the Data-ICal-DateTime CPAN distribution.

Report information
The Basics
Id: 125633
Status: open
Priority: 0/
Queue: Data-ICal-DateTime

People
Owner: Nobody in particular
Requestors: jv [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.82
Fixed in: (no value)



Subject: Retain VALUE=DATE property
Download (untitled) / with headers
text/plain 393b
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
Download t.pl
text/x-perl 562b
#!/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" );
RT-Send-CC: FGLOCK [...] cpan.org
Download (untitled) / with headers
text/plain 1022b
Hi Johan, So, just to clarify - is the issue a loss of data when round tripping or is it the inability to set truncated Dates as opposed to DateTimes? If it's the former then that seems like a bug. If it's the latter then I'm not sure what to do - a quick poke through DateTime's docs seems to confirm what I thought i.e that there's no way to truncate() a DateTime to a Date in such a way to make it distinguishable from midnight on the same day (which would be possible if hours, minutes and seconds were undef instead of 0). Maybe the solution is to allow an extra optional parameter to $event->start and $event->end that allowed truncation e.g $event->start($dt1, truncate => 'day'); I don't really do much Perl anymore and haven't used Data::ICal::DateTime for a while - Flavio (CC'd) did the last release. I can try and find time to play around with this if you'd like but it might be a while. Or, if you'd like to take a go then the github repo is https://github.com/simonwistow/Data-ICal-DateTime Simon


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.