fixed bug 650133

This commit is contained in:
JT Smith 2002-12-10 04:37:28 +00:00
parent b1c01415ac
commit 55cfaa5a4d
2 changed files with 24 additions and 1 deletions

View file

@ -35,6 +35,7 @@ our @EXPORT = qw(&localtime &time &addToTime &addToDate &epochToHuman &epochToSe
use WebGUI::DateTime;
$epoch = WebGUI::DateTime::addToDate($epoch, $years, $months, $days);
$epoch = WebGUI::DateTime::addToTime($epoch, $hours, $minutes, $seconds);
($startEpoch, $endEpoch) = WebGUI::DateTime::dayStartEnd($epoch);
$dateString = WebGUI::DateTime::epochToHuman($epoch, $formatString);
$setString = WebGUI::DateTime::epochToSet($epoch);
$day = WebGUI::DateTime::getDayName($dayInteger);
@ -127,6 +128,26 @@ sub addToTime {
#-------------------------------------------------------------------
=head2 dayStartEnd ( epoch )
Returns the epoch dates for the start and end of the day.
=item epoch
The number of seconds since January 1, 1970.
=cut
sub dayStartEnd {
my ($year,$month,$day, $hour,$min,$sec, $start, $end);
($year,$month,$day, $hour,$min,$sec) = Date::Calc::Time_to_Date($_[0]);
$start = Date::Calc::Date_to_Time($year,$month,$day,0,0,0)-43200;
$end = Date::Calc::Date_to_Time($year,$month,$day,23,59,59);
return ($start, $end);
}
#-------------------------------------------------------------------
=head2 epochToHuman ( [ epoch, format ] )
Returns a formated date string.

View file

@ -409,7 +409,7 @@ sub www_editEventSave {
#-------------------------------------------------------------------
sub www_view {
my (%var, $sameDate, $p, @list, $date, $flag, %previous, @row, $i, $maxDate, $minDate);
my (%var, $junk, $sameDate, $p, @list, $date, $flag, %previous, @row, $i, $maxDate, $minDate);
tie %previous, 'Tie::CPHash';
$var{"addevent.url"} = WebGUI::URL::page('func=editEvent&eid=new&wid='.$_[0]->get("wobjectId"));
$var{"addevent.label"} = WebGUI::International::get(20,$namespace);
@ -418,6 +418,7 @@ sub www_view {
where wobjectId=".$_[0]->get("wobjectId"));
}
$minDate = $minDate || time();
($minDate,$junk) = WebGUI::DateTime::dayStartEnd($minDate);
if ($_[0]->get("endMonth") eq "last") {
($maxDate) = WebGUI::SQL->quickArray("select max(endDate) from EventsCalendar_event where
wobjectId=".$_[0]->get("wobjectId"));
@ -431,6 +432,7 @@ sub www_view {
$maxDate = WebGUI::DateTime::addToDate($minDate,0,3,0);
}
$maxDate = $maxDate || time();
($junk,$maxDate) = WebGUI::DateTime::dayStartEnd($maxDate);
my $monthCount = WebGUI::DateTime::monthCount($minDate,$maxDate);
unless ($session{form}{pn}) {
$flag = 1;