Skip to main content

cdate

Reproducible date formats for correspondence.

crates.io npm PyPI Rust API

Format a Gregorian calendar date without a timezone, operating-system locale, or network dependency. The same inputs produce the same text in Rust, JavaScript, Python, and Typst.

import { longDate } from '@corbet-labs/cdate';

longDate('de-ch', 2026, 9, 7);
// 7. September 2026

Install

Environment Command
Rust / Cargo cargo add cdate
Python / pip python -m pip install cdate
Python / uv uv add cdate
Node.js / npm npm install @corbet-labs/cdate
pnpm pnpm add @corbet-labs/cdate
Yarn yarn add @corbet-labs/cdate
Bun bun add @corbet-labs/cdate
Deno deno add npm:@corbet-labs/cdate

The 0.2.1 JavaScript distribution includes compiled ESM, CommonJS, TypeScript declarations, and a standalone browser module. Node.js 20+ is supported; no TypeScript loader is required.

// CommonJS
const { longDate } = require('@corbet-labs/cdate');
<script type="module">
  import { longDate } from 'https://cdn.jsdelivr.net/npm/@corbet-labs/cdate@0.2.1/dist/browser.js';
  console.log(longDate('de-ch', 2026, 9, 7));
</script>

Python 3.10+ packages are available on PyPI. See the installation guide for CLI commands and other distribution options. JSR publication and Typst availability are listed there explicitly.

Rust

use cdate::{long_date, month_year};

assert_eq!(long_date("de-ch", 2026, 9, 7).as_deref(), Some("7. September 2026"));
assert_eq!(month_year("en", 2026, 9).as_deref(), Some("September 2026"));

Python

from cdate import long_date

assert long_date("de-ch", 2026, 9, 7) == '7. September 2026'

API

JavaScript / Python or Rust Example for de-ch
longDate / long_date 7. September 2026
mediumDate / medium_date 07.09.2026
shortDate / short_date 07.09.26
monthYear / month_year September 2026
isValidDate / is_valid_date Calendar-date validation

The seven date-table entries are de, de-at, de-ch, de-li, en, en-gb, and en-us. Matching is case-insensitive; other locales fall back through the base language to English. Impossible calendar dates return null/None. Inputs are calendar components, not timestamps. Other family libraries have broader locale coverage.

Correspondence family

Library Responsibility
cletter Compose the correspondence helpers
cgreet German salutations and titles
cfarewell Locale-specific closings
cdate Calendar-date formatting
cink Handwritten signature images

Development

Behavior is defined by the locale tables and shared conformance vectors. Rust, JavaScript, and Python run the same vectors. Selected CI checks exercise installed JavaScript tarballs, Python wheels and command-line entrypoints, and Typst packages. Release validation records the actual runtime and platform; Linux results do not establish native Windows or macOS coverage. All five Rust crates forbid unsafe code in their own source.

See the release guide for generation, verification, and publication commands.

License

Copyright 2026 Julian Y. Richard Corbet. The 0.3.0 release line is licensed under LGPL-3.0-only [WITH LGPL-3.0-linking-exception](https://github.com/corbet-labs/cdate/blob/main/LICENSES/LGPL-3.0-only%20WITH%20LGPL-3.0-only WITH LGPL-3.0-linking-exception.txt), with the incorporated GPL version 3. Combined works may link statically or dynamically without relinking duties; library modifications stay LGPL. Applications can use a different license subject to the LGPL's conditions. Previously released and already prepared distributions retain their original grants. The installation examples above refer to those available releases; 0.3.0 has not yet been published to registries.

See the licensing notes for distribution conditions and retained notices.

Release files for cdate 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdate 0.3.0
File Size Uploaded
cdate-0.3.0.tar.gz 37.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cdate 0.3.0
File Interpreter ABI Platform
cdate-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 75.6 kB

Release files / cdate-0.3.0.tar.gz

Download URL cdate-0.3.0.tar.gz
Size 37.7 kB
Tags Source
SHA-256 checksum
How to use checksums
553745bf18e76e52eadb016af933b4132c630d2b6746f7c47bf98e0a2f23e0c8
BLAKE2b-256 checksum
How to use checksums
d797cb1738f937605e4c047651bb01923ab15bd6f60568a26989520763b39347
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / cdate-0.3.0-py3-none-any.whl

Download URL cdate-0.3.0-py3-none-any.whl
Size 37.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0439927973dc2b587c7f84d0e968606d77d89bf5a99c67a24c8bb1d7b312fcd
BLAKE2b-256 checksum
How to use checksums
f94bb80961613ff7bcf5417e146aeacd52ab2180a57ead730b7f9aa4bc1b21b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.3.1

2 release files

This release

0.3.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page