Skip Menu |
 

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

Report information
The Basics
Id: 81391
Status: open
Priority: 0/
Queue: Date-ICal

People
Owner: Nobody in particular
Requestors: asjo [...] koldfront.dk
Cc:
AdminCc:

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

Attachments


Subject: Can't output time 00:00
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1353710838-881-9"
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 380
Download (untitled) / with headers
text/plain 380b
I am using Data::ICal to export a calendar to an .ics file and importing it on an Android phone using iCalSync. iCalSync doesn't like dates without a time - probably a bug in iCalSync, but I need to work around it. Date::ICal skips the time if hours, minutes and seconds aren't true - maybe it should only skip it they aren't defined? Patch attached. Best regards, Adam
Subject: output_time_if_defined.patch
MIME-Version: 1.0
Content-Type: text/x-diff; name="output_time_if_defined.patch"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline; filename="output_time_if_defined.patch"
Content-Transfer-Encoding: binary
Content-Length: 587
--- ICal.pm_orig 2012-11-23 22:58:19.361238426 +0100 +++ ICal.pm 2012-11-23 22:58:39.076759868 +0100 @@ -284,7 +284,7 @@ # make output in UTC by default # if we were originally given this time in offset # form, we'll need to adjust it for output - if ( $self->hour || $self->min || $self->sec ) { + if ( defined $self->hour || defined $self->min || defined $self->sec ) { $ical = sprintf( '%04d%02d%02dT%02d%02d%02dZ', $self->year, $self->month, $self->day, $self->hour, $self->minute, $self->second );
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-9478-1354574395-783.81391-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 614
Download (untitled) / with headers
text/plain 614b
The below was filed in the Data::ICal queue originally, but it's a feature request for Date::ICal. It's an easy mistake being off by one letter. :) On Fri Nov 23 17:47:18 2012, asjo@koldfront.dk wrote: Show quoted text
> I am using Data::ICal to export a calendar to an .ics file and importing > it on an Android phone using iCalSync. > > iCalSync doesn't like dates without a time - probably a bug in iCalSync, > but I need to work around it. > > Date::ICal skips the time if hours, minutes and seconds aren't true - > maybe it should only skip it they aren't defined? > > Patch attached. > > Best regards, > > Adam
From asjo [...] koldfront.dk Tue Dec 4 13: 24:11 2012
MIME-Version: 1.0
X-Spam-Status: No, score=-6.235 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_SOFTFAIL=0.665] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-9478-1354574396-1626.81391-6-0 [...] rt.cpan.org> (Thomas Sibley via's message of "Mon, 3 Dec 2012 17:39:56 -0500")
X-Spam-Flag: NO
References: <RT-Ticket-81391 [...] rt.cpan.org> <rt-3.8.HEAD-9478-1354574396-1626.81391-6-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <8738zln0an.fsf [...] topper.koldfront.dk>
Content-Type: text/plain; charset="utf-8"
X-Face: )qY&CseJ?.:=8F#^~GcSA?F=9eu'{KAFfL1C3/A&:nE?PW\i65"ba0NS)97,Q(^ [...] xk}n4Ou rPuR#V8I(J_ [...] ~H($[ym:`K_+]*kjvW>xH5jbgLBVFGXY:(#4P>zVBklLbdL&XxL\M)%T}3S/IS9lMJ ^St'=VZBR<gm`!Dj`dIpp?+$"$l_'JKDN\w-jB;fo0Qy}Tbw
Organization: koldfront - analysis & revolution, Copenhagen, Denmark
X-Hashcash: 1:21:121204:bug-date-ical [...] rt.cpan.org::4SnwN51E/qU6ix33:000000000000000000000000000000000000ENOU
X-Image-Url: http://asjo.koldfront.dk/pics/x-face.png
X-RT-Original-Encoding: utf-8
X-Spam-Score: -6.235
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 00B30240A2D for <cpan-bug+Date-ICal [...] hipster.bestpractical.com>; Tue, 4 Dec 2012 13:24:11 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id arukpLv6E2MU for <cpan-bug+Date-ICal [...] hipster.bestpractical.com>; Tue, 4 Dec 2012 13:24:09 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 390522408FA for <bug-Date-ICal [...] rt.cpan.org>; Tue, 4 Dec 2012 13:24:08 -0500 (EST)
Received: (qmail 17988 invoked by uid 103); 4 Dec 2012 18:24:08 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 4 Dec 2012 18:24:08 -0000
Received: from 2505ds5-by.0.fullrate.dk (HELO topper.koldfront.dk) (89.150.142.116) by 16.mx.develooper.com (qpsmtpd/0.84/v0.84-167-g4ed6cab) with ESMTP; Tue, 04 Dec 2012 10:24:04 -0800
Received: by topper.koldfront.dk (Postfix, from userid 1000) id 8E70B50FA6F5; Tue, 4 Dec 2012 19:24:00 +0100 (CET)
Delivered-To: cpan-bug+Date-ICal [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #81391] Can't output time 00:00
User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux)
X-Now-Playing: Harbor Song, Songs In Red And Gray (Suzanne Vega)
Return-Path: <asjo [...] koldfront.dk>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+Date-ICal [...] hipster.bestpractical.com
X-RT-Mail-Extension: date-ical
Openpgp: id=21BDE416; url=http://asjo.koldfront.dk/gpg.asc
Date: Tue, 04 Dec 2012 19:24:00 +0100
X-Spam-Level:
To: bug-Date-ICal [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: asjo [...] koldfront.dk (Adam Sjøgren)
RT-Message-ID: <rt-3.8.HEAD-29279-1354645451-960.81391-0-0 [...] rt.cpan.org>
Content-Length: 582
Download (untitled) / with headers
text/plain 582b
On Mon, 3 Dec 2012 17:39:56 -0500, Thomas Sibley wrote: Show quoted text
> The below was filed in the Data::ICal queue originally, but it's a > feature request for Date::ICal. It's an easy mistake being off by one > letter. :)
Thanks for the correction - I think I simply assumed that Date::ICal was part of Data::ICal (I use them together, maybe by typo, even; it's an oldish program)! Sorry for the mix-up :-) Best regards, Adam -- "Money always takes the place of life" Adam Sjøgren asjo@koldfront.dk
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-29279-1354645451-960.81391-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <RT-Ticket-81391 [...] rt.cpan.org> <rt-3.8.HEAD-9478-1354574396-1626.81391-6-0 [...] rt.cpan.org> <8738zln0an.fsf [...] topper.koldfront.dk> <rt-3.8.HEAD-29279-1354645451-960.81391-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-24513-1548346148-1703.81391-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 1340
Download (untitled) / with headers
text/plain 1.3k
I also ran into this issue, but defined a method guaranteed to return a DATE-TIME, leaving the existing behavior alone. (I don't know why anyone would rely on the existing behavior, but as it's been a long time, who knows?) In any case, the nice thing about this approach is that until/unless the maintainer comes up with a fix, the code can go in your application. If it ever IS fixed, this code is harmless. And, the maintainer could just add the subroutine... # Version of 'ical' method that ensures # that returned string is a DATE-TIME, not just a DATE (at 00:00:00Z) # Extends Date::ICal objects. Same arguments as 'ical'. # Or, you can call it with the result of Date::ICal::ical # to fixup the string. # # $x = Date::ICal->new( … ) # $string = $x->ical_dt( offset => '+0400' ); # $ical = $x->ical; $string = Date::ICal::ical_dt( $ical, offset => … ) # Except for the object or string, arguments are optional. # The optional arguments are ignored if a string is supplied. # # See https://rt.cpan.org/Public/Bug/Display.html?id=81391 { package Date::ICal; sub ical_dt { my $dt = shift; $dt = $dt->ical( @_ ) if( ref $dt ); # If just a UTC date, it's midnight UTC. # Convert the DATE to a DATE-TIME. $dt = "$1T000000Z" if( $dt =~ /^(\d{8})Z$/ ); return $dt; } }


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.