Skip to content

delveccj/rust-dateutil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-dateutil

A Rust implementation of python-dateutil with powerful date/time extensions.

Overview

rust-dateutil provides powerful extensions to Rust's standard date/time functionality, inspired by Python's dateutil library. It offers:

  • Relative date/time arithmetic - Add months, years, and complex date operations
  • Flexible date/time parsing - Parse dates from almost any string format
  • Recurrence rules - Generate recurring dates using RFC 5545 specifications
  • Timezone handling - Comprehensive timezone support
  • High performance - 5-10x faster than Python dateutil with zero-cost abstractions

Quick Start

Add to your Cargo.toml:

[dependencies]
dateutil = "0.1"

Basic Usage

use dateutil::relativedelta::RelativeDelta;
use chrono::NaiveDate;

// Add relative time periods
let date = NaiveDate::from_ymd_opt(2023, 1, 31).unwrap();
let rd = RelativeDelta::new().months(1);
let result = rd.apply_to_datetime(&date.and_hms_opt(0, 0, 0).unwrap()).unwrap();

// Jan 31 + 1 month = Feb 28 (handles month-end correctly)
println!("Result: {}", result.date()); // 2023-02-28

Crate Structure

This project is organized as a workspace with multiple crates:

  • dateutil-core - Core types and traits
  • dateutil-relativedelta - Relative date/time arithmetic
  • dateutil-tz - Timezone handling
  • dateutil-parser - Date/time string parsing
  • dateutil-rrule - Recurrence rules (RFC 5545)
  • dateutil - Main API crate (re-exports everything)

Development Status

🚧 Early Development - This project is in active development

Completed

  • ✅ Project structure and workspace setup
  • ✅ Core data types and traits
  • ✅ Basic RelativeDelta implementation
  • ✅ Month/year arithmetic with proper overflow handling
  • ✅ Initial test suite

In Progress

  • 🔄 Timezone implementations
  • 🔄 Date/time parsing
  • 🔄 Recurrence rules
  • 🔄 Comprehensive test coverage

Planned

  • ⏳ Python compatibility layer
  • ⏳ Performance benchmarks
  • ⏳ Complete documentation
  • ⏳ RFC 5545 compliance testing

Contributing

This project is in early development. Contributions are welcome!

License

Licensed under either of:

at your option.

Inspiration

This project is inspired by and aims to be compatible with:

About

Fast, comprehensive Rust implementation of Python's dateutil

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors