]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/MsgTime.pm
msgtime: assume +0000 if TZ missing when using Date::Parse
[public-inbox.git] / lib / PublicInbox / MsgTime.pm
index 9f4326442dd110d12a40f96595d3b2b2da7461aa..8703d7bc0a78293dbe4735e34c5a339ad8cffb6c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2019 all contributors <meta@public-inbox.org>
+# Copyright (C) 2018-2020 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # Various date/time-related functions
@@ -104,7 +104,8 @@ sub str2date_zone ($) {
                # off is the time zone offset in seconds from GMT
                my ($ss,$mm,$hh,$day,$month,$year,$off) =
                                        Date::Parse::strptime($date);
-               return undef unless(defined $off);
+               return unless defined($year);
+               $off //= 0;
 
                # Compute the time zone from offset
                my $sign = ($off < 0) ? '-' : '+';