php-dates 0.2.1

PHP date() patterns for Rust: strict createFromFormat-style parsing, a pattern resolution contract and a Day.js export, with no framework dependency
Documentation
//! PHP date patterns for Rust.
//!
//! [`PhpDatePattern`] formats like `DateTime::format()` and parses like `DateTime::createFromFormat()`, in English,
//! with [`PhpDateTime`] and [`Zone`] for time zones. [`formats`] resolves which pattern applies from a
//! [`DateConfig`] and exports patterns to Day.js.
//!
//! ```
//! use php_dates::{PhpDatePattern, PhpDateTime, Zone};
//!
//! let pattern = PhpDatePattern::compile("d/m/Y H:i T")?;
//! let madrid = Zone::parse("Europe/Madrid").ok_or("unknown zone")?;
//! let date = PhpDateTime::new(jiff::civil::date(2026, 7, 1).at(8, 30, 0, 0), madrid)?;
//! assert_eq!(pattern.format(&date), "01/07/2026 08:30 CEST");
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! [`jiff`] is re-exported: its types are part of this crate's API. The `tzdb-bundle` feature builds the time zone
//! database into the binary, for systems without one.

#![warn(missing_docs)]

mod config;
mod error;
mod format;
pub mod formats;
mod names;
mod parse;
mod pattern;
mod zone;

pub use config::{DateConfig, DatePatterns};
pub use error::{Error, Result};
pub use formats::{Kind, Purpose};
/// The date library whose types this crate takes and returns.
pub use jiff;
pub use parse::ParseError;
pub use pattern::PhpDatePattern;
pub use zone::{PhpDateTime, Zone};

/// The examples of the README are compiled and run as tests.
#[cfg(doctest)]
#[doc = include_str!("../README.md")]
struct ReadmeDoctests;