def parse_date(raw, is_w3cdtf=False): raw = raw.strip() if is_w3cdtf: ans = parse_iso8601(raw, assume_utc=True) if 'T' not in raw and ' ' not in raw: ans = fix_only_date(ans) else: ans = parse_date_(raw, assume_utc=True) if ' ' not in raw and 'T' not in raw and (ans.hour, ans.minute, ans.second) == (0, 0, 0): ans = fix_only_date(ans) return ans