php-dates
PHP date patterns and the shared PHP/Day.js date format contract of
reynotech/laravel-query-builder-custom, as a crate with
no framework or database dependency. The Rust port of reynotech/laravel-query-builder-custom uses it for its date filters.
use ;
let config = default;
let pattern = compile?;
let date = pattern.parse.unwrap;
assert_eq!;
let dayjs = to_dayjs?; // "DD/MM/YYYY hh:mm A"
Patterns
Supported tokens: d j m n Y y H G h g i s a A, \x escapes and any non-letter literal. Other letters are rejected
instead of being read differently. Parsing is strict: the text must read back to exactly the same text, so 2/2026 is
not m/Y and 31/02/2026 is not a date.
Resolution order
formats::format picks the pattern for a kind (Date, DateTime, Month) and a purpose (Display, Value,
Filter): value.<kind> or filter.<kind> for the purpose, then <kind>, then the legacy date_format_solo (date) or
date_format (date-time), then the fallback the caller passes, then the default (d/m/Y, d/m/Y h:i a, m/Y).
License
MIT. See LICENSE.md.