tktax-date
This crate provides robust Serde-compliant serialization and deserialization for the NaiveDate type from chrono. It accommodates various US-centric date formats (MM/DD/YYYY, MM/DD/YY, and variants allowing single-digit months/days). This is particularly helpful for systems handling multiple date-string formats in a unified manner.
Features
-
Multiple Format Parsing
- Attempts to parse input strings using a list of known patterns.
- Returns a parsing error if no format successfully matches.
-
Consistent Serialization
- Always serializes to the canonical
"MM/DD/YYYY"format for uniform downstream processing.
- Always serializes to the canonical
-
Serde Integration
- Compatible with
serdeserialize/deserializetraits. - Zero-boilerplate usage in typical Serde contexts.
- Compatible with
Installation
In your Cargo.toml, add:
[]
= "0.1.0"
= "0.4"
= "1.0"
Usage
use ;
use NaiveDate;
use naive_date_format;
Testing
Unit tests are included under the serde_naive_date_format_tests module to validate deserialization from various string formats. Run:
License
Licensed under the MIT license. See LICENSE for details.
Contributing
Issues and pull requests are welcome on GitHub.