Use dateutil.parser instead of specific strptime.

This commit is contained in:
voussoir 2022-07-10 13:31:40 -07:00
parent 7a60f23ebf
commit c32f89da7d
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -1,8 +1,10 @@
import copy import copy
import datetime import datetime
import dateutil.parser
import io import io
import PIL.ExifTags import PIL.ExifTags
import PIL.Image import PIL.Image
import re
from voussoirkit import pathclass from voussoirkit import pathclass
@ -83,7 +85,8 @@ def get_exif_datetime(image) -> datetime.datetime:
if not exif_date: if not exif_date:
return return
return datetime.datetime.strptime(exif_date, '%Y:%m:%d %H:%M:%S') exif_date = re.sub(r'(\d\d\d\d):(\d\d):(\d\d)', r'\1-\2-\3', exif_date)
return dateutil.parser.parse(exif_date)
def pad_to_square(image, background_color=None) -> PIL.Image: def pad_to_square(image, background_color=None) -> PIL.Image:
''' '''