Add an Event method for returning a non-inclusive end DataTime object.
Have Calendar use that for determining the end of a week in viewWeek. Fix getEventsIn to do all comparisons in UTC so that extra events are not added in.
This commit is contained in:
parent
f04a162ea3
commit
1bcae0d3bc
4 changed files with 213 additions and 37 deletions
|
|
@ -391,6 +391,28 @@ sub getDateTimeEnd {
|
|||
}
|
||||
}
|
||||
|
||||
####################################################################
|
||||
|
||||
=head2 getDateTimeEndNI
|
||||
|
||||
Since the iCal standard is that ending dates are non-inclusive (they
|
||||
do not include the second at the end of the time period), this method
|
||||
provide a copy of the DateTime object that is 1 second earlier than
|
||||
the set ending time.
|
||||
|
||||
It's just one line of DateTime code to adjust this on any object, but
|
||||
this is encapsulated here to make sure that the same amount of time
|
||||
is used EVERYWHERE.
|
||||
|
||||
=cut
|
||||
|
||||
sub getDateTimeEndNI {
|
||||
my $self = shift;
|
||||
my $dt = $self->getDateTimeEnd;
|
||||
$dt->subtract(seconds => 1);
|
||||
return $dt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1277,7 +1299,8 @@ sub getTemplateVars {
|
|||
$var{ "startDateEpoch" } = $dtStart->epoch;
|
||||
|
||||
# End date/time
|
||||
my $dtEnd = $self->getDateTimeEnd;
|
||||
my $dtEnd = $self->getDateTimeEnd;
|
||||
my $dtEndNI = $self->getDateTimeEndNI;
|
||||
|
||||
$var{ "endDateSecond" } = sprintf "%02d", $dtEnd->second;
|
||||
$var{ "endDateMinute" } = sprintf "%02d", $dtEnd->minute;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue