Typing Stubs for dateparser

1.4.0.20260408 · active · verified Sat Apr 11

types-dateparser is a type stub package that provides external type annotations for the `dateparser` library. It enables static type checkers (like MyPy or Pyright) to analyze code using `dateparser` for type correctness without affecting runtime behavior. The current version, `1.4.0.20260408`, indicates it aims to provide accurate annotations for `dateparser~=1.4.0`, with the last part reflecting the typeshed release date. Updates are frequent, often daily, reflecting typeshed's continuous integration and bug fixes.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the typical usage of the `dateparser` library, which is enhanced by the `types-dateparser` stubs for static type checking. The stubs themselves are not directly used in the runtime code.

import dateparser
from datetime import datetime

# types-dateparser provides type hints for the dateparser library.
# It is not imported directly for runtime functionality.

date_string = "today"
parsed_date: datetime | None = dateparser.parse(date_string)

if parsed_date:
    print(f"Parsed '{date_string}': {parsed_date}")
else:
    print(f"Could not parse '{date_string}'")

# Example with a specific format and language setting
french_date_string = "20 Février 2023"
parsed_french_date: datetime | None = dateparser.parse(
    french_date_string, languages=['fr']
)
if parsed_french_date:
    print(f"Parsed '{french_french_date_string}' (French): {parsed_french_date}")

view raw JSON →