Allow users to enter 24:00:00 by hand, and have the Event handle it correctly. Fixes bug #11788
This commit is contained in:
parent
3c15058bc6
commit
1d99ee451e
3 changed files with 47 additions and 5 deletions
|
|
@ -1711,8 +1711,37 @@ Wrap update so that isHidden is always set to be a 1.
|
|||
=cut
|
||||
|
||||
sub update {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
my $session = $self->session;
|
||||
if (my $startTime = $properties->{startTime}) {
|
||||
my ($startHour, $startMinute, $startSecond) = $startTime =~ /^ (\d+) : (\d+) (?: :(\d+)) /x;
|
||||
if ($startHour > 23) {
|
||||
$startHour = 0;
|
||||
my $startDate = exists $properties->{startDate} ? $properties->{startDate} : $self->get('startDate');
|
||||
$session->log->warn('startDate: '. $startDate);
|
||||
my $startDt = WebGUI::DateTime->new($session, $startDate);
|
||||
$startDt->add(days => 1);
|
||||
$properties->{startDate} = $startDt->toMysqlDate;
|
||||
$session->log->warn('startDate: '. $properties->{startDate});
|
||||
$startSecond = '00' if ! $startSecond;
|
||||
$properties->{startTime} = sprintf '%02d:%02d:%02d', $startHour, $startMinute, $startSecond;
|
||||
}
|
||||
}
|
||||
if (my $endTime = $properties->{endTime}) {
|
||||
my ($endHour, $endMinute, $endSecond) = $endTime =~ /^ (\d+) : (\d+) (?: :(\d+)) /x;
|
||||
if ($endHour > 23) {
|
||||
$endHour = 0;
|
||||
my $endDate = exists $properties->{endDate} ? $properties->{endDate} : $self->get('endDate');
|
||||
$session->log->warn('endDate: '. $endDate);
|
||||
my $endDt = WebGUI::DateTime->new($session, $endDate);
|
||||
$endDt->add(days => 1);
|
||||
$properties->{endDate} = $endDt->toMysqlDate;
|
||||
$session->log->warn('endDate: '. $properties->{endDate});
|
||||
$endSecond = '00' if ! $endSecond;
|
||||
$properties->{endTime} = sprintf '%02d:%02d:%02d', $endHour, $endMinute, $endSecond;
|
||||
}
|
||||
}
|
||||
return $self->SUPER::update({%$properties, isHidden => 1});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue