[LON-CAPA-cvs] cvs: modules /raeburn/register registrations.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Mon, 14 Apr 2008 20:48:20 -0000
raeburn Mon Apr 14 16:48:20 2008 EDT
Modified files:
/modules/raeburn/register registrations.pm
Log:
- For date-only fields, floating Time Zone was causing displayed eventstart to be offset by 1 day.
- eliminate this by appending 12:00 to the value retrieved from event_config table and using DateTime::Format::MySQL->parse_datetime() to generate DateTime object.
Index: modules/raeburn/register/registrations.pm
diff -u modules/raeburn/register/registrations.pm:1.6 modules/raeburn/register/registrations.pm:1.7
--- modules/raeburn/register/registrations.pm:1.6 Mon Apr 14 12:05:50 2008
+++ modules/raeburn/register/registrations.pm Mon Apr 14 16:48:17 2008
@@ -6,7 +6,7 @@
# privilege for an event can edit the contents of the registration
# form.
#
-# $Id: registrations.pm,v 1.6 2008/04/14 16:05:50 raeburn Exp $
+# $Id: registrations.pm,v 1.7 2008/04/14 20:48:17 raeburn Exp $
#
# Stuart P Raeburn
#
@@ -2572,7 +2572,8 @@
foreach my $date (@dates) {
my $current;
if ($in->{$date}) {
- my $dateobj = DateTime::Format::MySQL->parse_date($in->{$date});
+ my $datetime = $in->{$date}.' 12:00:00';
+ my $dateobj = DateTime::Format::MySQL->parse_datetime($datetime);
$current = $dateobj->epoch;
}
$dateforms{$date} =
@@ -2881,14 +2882,9 @@
}
} elsif (grep(/^\Q$item\E$/,@dates)) {
my $newval = Apache::LON::Utilities::get_date_from_form($params,$item);
- my $current;
- if ($in->{$item}) {
- my $dateobj = DateTime::Format::MySQL->parse_date($in->{$item});
- $current = $dateobj->epoch;
- }
- if ($current ne $newval) {
- my $newdt = DateTime->from_epoch( epoch => $newval );
- my $newdate = DateTime::Format::MySQL->format_date($newdt);
+ my $newdt = DateTime->from_epoch( epoch => $newval );
+ my $newdate = DateTime::Format::MySQL->format_date($newdt);
+ if ($newdate ne $in->{$item}) {
$changes{$item} = $newdate;
}
} elsif ($params->{$item} ne $in->{$item}) {