diff options
author | Perl Tidy <perltidy@bugzilla.org> | 2018-12-05 21:38:52 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-12-05 23:49:08 +0100 |
commit | 8ec8da0491ad89604700b3e29a227966f6d84ba1 (patch) | |
tree | 9d270f173330ca19700e0ba9f2ee931300646de1 /extensions/BugModal/lib/Util.pm | |
parent | a7bb5a65b71644d9efce5fed783ed545b9336548 (diff) | |
download | bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.gz bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.xz |
no bug - reformat all the code using the new perltidy rules
Diffstat (limited to 'extensions/BugModal/lib/Util.pm')
-rw-r--r-- | extensions/BugModal/lib/Util.pm | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/extensions/BugModal/lib/Util.pm b/extensions/BugModal/lib/Util.pm index 6a453159e..b1d7068d8 100644 --- a/extensions/BugModal/lib/Util.pm +++ b/extensions/BugModal/lib/Util.pm @@ -21,19 +21,21 @@ use DateTime::TimeZone; use Time::Local qw(timelocal); sub date_str_to_time { - my ($date) = @_; - # avoid creating a DateTime object - if ($date =~ /^(\d{4})[\.\-](\d{2})[\.\-](\d{2}) (\d{2}):(\d{2}):(\d{2})$/) { - return timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900); - } - state $tz //= DateTime::TimeZone->new( name => 'local' ); - my $dt = datetime_from($date, $tz); - if (!$dt) { - # this should never happen - warn("invalid datetime '$date'"); - return undef; - } - return $dt->epoch; + my ($date) = @_; + + # avoid creating a DateTime object + if ($date =~ /^(\d{4})[\.\-](\d{2})[\.\-](\d{2}) (\d{2}):(\d{2}):(\d{2})$/) { + return timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900); + } + state $tz //= DateTime::TimeZone->new(name => 'local'); + my $dt = datetime_from($date, $tz); + if (!$dt) { + + # this should never happen + warn("invalid datetime '$date'"); + return undef; + } + return $dt->epoch; } 1; |