skillfed

click-datetime

Datetime type support for click.

click-datetime v0.4.0 75.5K downloads/30d#14,708 on PyPI
Permissive license MIT DORMANT released

What it is and what it does

Click-datetime is a small extension that teaches Click how to parse datetime values from command-line arguments. It wraps Python's datetime type as a Click parameter type, letting you define a format string and automatically convert user input into datetime objects. The package sits between Click's parameter system and Python's datetime module, handling the string-to-object conversion so your CLI code receives properly typed datetime values instead of raw strings.

The package is straightforward: you instantiate a Datetime type with a format string, attach it to a Click option or argument, and the conversion happens automatically. It has no external dependencies beyond Click itself. However, the package is dormant—the last release was 704 days ago—so it receives no active maintenance. If you need datetime parsing in a Click CLI and the format is simple, this package works; if you encounter bugs or need support for complex datetime scenarios, you may need to patch it yourself or implement the conversion inline.

Use it for:

  • Accept a date parameter in a CLI tool and receive a datetime object directly without manual string parsing.
  • Build a backup or log-analysis CLI that takes date ranges as command-line arguments with automatic validation.
  • Create a scheduling CLI where users specify dates in a consistent format and your code validates them automatically.
  • Develop a data-processing script that accepts date filters from the command line with format validation built in.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Adds datetime type support to Click, allowing CLI developers to parse and validate date strings as command-line parameters with custom format specifications.

Yes, if you are building a Click CLI that needs datetime parameters and you are comfortable with a dormant package. The code is simple and the dependency footprint is minimal. No security vulnerabilities are known. The main trade-off is that you receive no active maintenance—if a bug appears or Click changes its internals, you will need to maintain a patch yourself or implement datetime parsing inline. For straightforward date-parameter use cases, the convenience outweighs the risk.

Install

click-datetime on PyPI

pip

pip install click-datetime

uv

uv add click-datetime

poetry

poetry add click-datetime

Installing click-datetime

Before you install

Low friction installation with only two runtime dependencies (click and wheel). Package is dormant—last release was 704 days ago—so expect no active maintenance or bug fixes.

License in practice

MIT license is permissive; you can use this package freely in commercial and open-source projects with minimal restrictions.

Quickstart

pip install click-datetime

from datetime import datetime
import click
from click_datetime import Datetime

@click.command()
@click.option('--date', type=Datetime(format='%Y-%m-%d'))
def cli(date):
    click.echo(f'Date: {date}')

if __name__ == '__main__':
    cli()

Requires Python 3.12 or later (package specifies >=3.12,<4.0).

Verify before relying

  • Whether the package works correctly with recent versions of Click (no changelog provided to confirm compatibility).
  • Whether datetime parsing handles edge cases like timezone-aware datetimes or invalid format strings gracefully.
  • Real-world stability and bug-fix responsiveness given dormant maintenance status.

Package facts

License MIT (permissive)
Python support supports the current Python release (<4.0,>=3.12)
Install friction low — pure-Python wheel
Runtime dependencies 2 — click, wheel
Maintenance dormant — 704 days since the last release
First released
Downloads 75,483/month — #14,708 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: click_datetime-0.4.0-py3-none-any.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.12

Tags

click datetime parsingcli date argument typeclick date parameterpython click datetime optioncommand line date parsingclick custom type datetimecli date string validation
cli-utilitiesdatetime-parsing

More Software Development packages