aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm12
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm24
2 files changed, 28 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index f51c939ff..40801306b 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -80,7 +80,11 @@ with 'FixMyStreet::Roles::Abuser';
my $tz = DateTime::TimeZone->new( name => "local" );
sub created_local {
- return shift->created->set_time_zone($tz);
+ my $self = shift;
+
+ return $self->created
+ ? $self->created->set_time_zone($tz)
+ : $self->created;
}
sub confirmed_local {
@@ -88,9 +92,9 @@ sub confirmed_local {
# if confirmed is null then it doesn't get inflated so don't
# try and set the timezone
- return $self->confirmed->set_time_zone($tz) if $self->confirmed;
-
- return 0;
+ return $self->confirmed
+ ? $self->confirmed->set_time_zone($tz)
+ : $self->confirmed;
}
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 2836f6c92..426f791c7 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -112,19 +112,35 @@ with 'FixMyStreet::Roles::Abuser';
my $tz = DateTime::TimeZone->new( name => "local" );
sub confirmed_local {
- return shift->confirmed->set_time_zone($tz);
+ my $self = shift;
+
+ return $self->confirmed
+ ? $self->confirmed->set_time_zone($tz)
+ : $self->confirmed;
}
sub created_local {
- return shift->created->set_time_zone($tz);
+ my $self = shift;
+
+ return $self->created
+ ? $self->created->set_time_zone($tz)
+ : $self->created;
}
sub whensent_local {
- return shift->whensent->set_time_zone($tz);
+ my $self = shift;
+
+ return $self->whensent
+ ? $self->whensent->set_time_zone($tz)
+ : $self->confirmed;
}
sub lastupdate_local {
- return shift->lastupdate->set_time_zone($tz);
+ my $self = shift;
+
+ return $self->lastupdate
+ ? $self->lastupdate->set_time_zone($tz)
+ : $self->lastupdate;
}
=head2 check_for_errors