forked from josch/img2pdf
fix date(1) based timestamp parser
This commit is contained in:
parent
79e9985f35
commit
c703e9df06
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue