RT->AddStyleSheets('calendar.css')
if RT->can('AddStyleSheets');
-our @EXPORT_OK = qw( FirstDay LastDay );
+our @EXPORT_OK = qw( FirstDay LastDay LastDayOfWeek DatesClauses LocalDate
+ SearchDefaultCalendar FindTickets );
sub FirstDay {
my ($year, $month, $matchday) = @_;
$day;
}
+sub LastDayOfWeek {
+ my ($year, $month, $day, $matchday) = @_;
+ my $set = DateTime::Set->from_recurrence(
+ next => sub { $_[0]->truncate( to => 'day' )->add( days => 1 ) }
+ );
+
+ my $dt = DateTime->new( year => $year, month => $month, day => $day );
+
+ $dt = $set->next($dt) while $dt->day_of_week != $matchday;
+ $dt;
+
+}
+
# we can't use RT::Date::Date because it uses gmtime
# and we need localtime
sub LocalDate {