From 33c742487de2211511266ad8512dc54885988209 Mon Sep 17 00:00:00 2001 From: Frank Dillon Date: Mon, 1 May 2006 20:15:40 +0000 Subject: [PATCH] Fixed error with monthStartEnd where timezone was not being set prior to getting the start and end of the month. --- lib/WebGUI/Session/DateTime.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Session/DateTime.pm b/lib/WebGUI/Session/DateTime.pm index 35fed7486..50563d0de 100644 --- a/lib/WebGUI/Session/DateTime.pm +++ b/lib/WebGUI/Session/DateTime.pm @@ -652,8 +652,12 @@ The number of seconds since January 1, 1970. sub monthStartEnd { my $self = shift; - my $dt = DateTime->from_epoch( epoch => shift); - my $end = DateTime->last_day_of_month(year=>$dt->year, month=>$dt->month); + my $epoch = shift; + my $dt = DateTime->from_epoch( epoch => $epoch); + my $end = DateTime->last_day_of_month(year=>$dt->year, month=>$dt->month); + $dt->set_time_zone($self->session->user->profileField("timeZone")|| "America/Chicago"); # assign the user's timezone + $end->set_time_zone($self->session->user->profileField("timeZone")|| "America/Chicago"); # assign the user's timezone + $dt->set_day(1); $dt->set_hour(0); $dt->set_minute(0); @@ -661,7 +665,8 @@ sub monthStartEnd { $end->set_hour(23); $end->set_minute(59); $end->set_second(59); - return ($dt->epoch, $end->epoch); + + return ($dt->epoch, $end->epoch); } #-------------------------------------------------------------------