def clean_text( self, text: str, fuzzy: bool = False, format: Optional[str] = None, proxy: Optional["EntityProxy"] = None, ) -> Optional[str]: """The classic: date parsing, every which way.""" if format is not None: return parse_format(text, format).text return parse(text).text
def to_datetime(self, value: str) -> Optional[datetime]: return parse(value).dt
def validate(self, value: str) -> bool: """Check if a thing is a valid date.""" prefix = parse(value) return prefix.precision != Precision.EMPTY