Forward porting Event iCal end day date math fix.

This commit is contained in:
Colin Kuskie 2009-08-03 22:56:10 +00:00
parent 38ff4f053b
commit 4ecc2c725e
3 changed files with 20 additions and 6 deletions

View file

@ -2,6 +2,7 @@
- fixed #10667: cannot change size of template editor
- fixed #10654: Story Archive: Search not working properly
- fixed #10692: Unprivileged users can stop spectre
- fixed #10720: Calendar iCal dates can exceed the number of days in a month
- fixed search indexer concatenates keywords to content.
- fixed Index Story fields for Search (headline, subtitle, location, byline, highlights, story)
- fixed #10619: Pagination macro

View file

@ -586,9 +586,8 @@ sub getIcalEnd {
my $self = shift;
if ($self->isAllDay) {
my $date = $self->get("endDate");
$date =~ s/\D//g;
$date += 1;
my $dte = $self->getDateTimeEnd->add(days => 1);
my $date = $dte->toIcalDate;
return $date;
}
else {

View file

@ -19,7 +19,7 @@ use WebGUI::Asset::Event;
use Test::More; # increment this value for each test you create
use Test::Deep;
plan tests => 13;
plan tests => 16;
my $session = WebGUI::Test->session;
@ -86,8 +86,8 @@ is($templateVars{isOneDay}, 0, 'getTemplateVars: isOneDay with different start a
cmp_ok($event3->getDateTimeEnd, '==', $event3->getDateTimeEndNI, 'getDateTimeEndNI is the same as getDateTimeEnd');
$properties->{startDate} = '2000-08-16';
$properties->{endDate} = '2000-08-17';
$properties->{startDate} = '2000-08-30';
$properties->{endDate} = '2000-08-31';
$properties->{startTime} = '00:00:00';
$properties->{endTime} = '00:00:00';
$properties->{id} = 'EventAssetTest00000004';
@ -96,3 +96,17 @@ $properties->{url} = 'event-asset-test4';
my $event4 = $cal->addChild($properties, $properties->{id});
cmp_ok($event4->getDateTimeEnd, '>', $event4->getDateTimeEndNI, 'getDateTimeEndNI is less than getDateTimeEnd');
is($event4->getIcalEnd, '20000831T000000Z', 'getIcalEnd, with defined time');
my $properties2 = {};
$properties2->{startDate} = '2000-08-31';
$properties2->{endDate} = '2000-08-31';
$properties2->{id} = 'EventAssetTest00000005';
$properties2->{url} = 'event-asset-test5';
$properties2->{className} = 'WebGUI::Asset::Event';
my $event5 = $cal->addChild($properties2, $properties2->{id});
is($event5->getIcalStart, '20000831', 'getIcalStart, with no start time');
is($event5->getIcalEnd, '20000901', 'getIcalEnd, with no end time, day incremented');