--- loncom/interface/lonhtmlcommon.pm 2005/06/18 17:23:25 1.109 +++ loncom/interface/lonhtmlcommon.pm 2005/06/18 18:51:50 1.110 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.109 2005/06/18 17:23:25 www Exp $ +# $Id: lonhtmlcommon.pm,v 1.110 2005/06/18 18:51:50 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -266,12 +266,15 @@ sub date_setter { if (! defined($no_hh_mm_ss)) { $no_hh_mm_ss = 0; } - if (! defined($currentvalue) || $currentvalue eq 'now') { - unless ($includeempty) { - $currentvalue = time; - $wasdefined=0; - } else { + if ($currentvalue eq 'now') { + $currentvalue=time; + } + if ((!defined($currentvalue)) || ($currentvalue eq '')) { + $wasdefined=0; + if ($includeempty) { $currentvalue = 0; + } else { + $currentvalue = time; } } # other potentially useful values: wkday,yrday,is_daylight_savings @@ -282,9 +285,18 @@ sub date_setter { $year += 1900; } unless ($wasdefined) { - $sec=($defsec?$defsec:0); - $min=($defmin?$defmin:0); - $hour=($defhour?$defhour:0); + if (($defhour) || ($defmin) || ($defsec)) { + ($sec,$min,$hour,$mday,$month,$year,undef,undef,undef) = + localtime(time); + $year += 1900; + $sec=($defsec?$defsec:0); + $min=($defmin?$defmin:0); + $hour=($defhour?$defhour:0); + } elsif (!$includeempty) { + $sec=0; + $min=0; + $hour=0; + } } my $result = "\n\n"; $result .= <