# Copyright (c) 2010-2021 openpyxl """Manage Excel date weirdness.""" # Python stdlib imports import datetime from math import isnan import re # constants MAC_EPOCH = datetime.datetime(1904, 1, 1) WINDOWS_EPOCH = datetime.datetime(1899, 12, 30) CALENDAR_WINDOWS_1900 = 2415018.5 # Julian date of WINDOWS_EPOCH CALENDAR_MAC_1904 = 2416480.5 # Julian date of MAC_EPOCH CALENDAR_WINDOWS_1900 = WINDOWS_EPOCH CALENDAR_MAC_1904 = MAC_EPOCH SECS_PER_DAY = 86400 ISO_FORMAT = '%Y-%m-%dT%H:%M:%SZ' ISO_REGEX = re.compile(r''' (?P(?P\d{4})-(?P\d{2})-(?P\d{2}))?T? (?P