1
0
Fork 0
forked from josch/img2pdf

fix date(1) based timestamp parser

This commit is contained in:
Johannes Schauer Marin Rodrigues 2023-06-11 07:48:23 +02:00
parent 79e9985f35
commit c703e9df06
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -3051,7 +3051,7 @@ def valid_date(string):
else: else:
try: try:
return parser.parse(string) return parser.parse(string)
except TypeError: except:
pass pass
# as a last resort, try the local date utility # as a last resort, try the local date utility
try: try:
@ -3064,7 +3064,7 @@ def valid_date(string):
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
pass pass
else: else:
return datetime.utcfromtimestamp(int(utime)) return datetime.fromtimestamp(int(utime))
raise argparse.ArgumentTypeError("cannot parse date: %s" % string) raise argparse.ArgumentTypeError("cannot parse date: %s" % string)