dtt 0.0.3

A Rust library for parsing, validating, manipulating, and formatting dates and times.
Documentation

DTT

A Rust library for parsing, validating, manipulating, and formatting dates and times

Made With Love Crates.io Lib.rs Docs.rs License Codecov

divider

Welcome to DTT 👋

DTT Banner

Website â€ĸ Documentation â€ĸ Report Bug â€ĸ Request Feature â€ĸ Contributing Guidelines

Overview 📖

The DateTime (DTT) library is a comprehensive and flexible tool that enables developers to manage dates and times with ease.

It offers a range of functions and data structures that allow you to perform various date and time operations with ease, such as determining the day of the month, hour of the day, working with ISO 8601 date and time formats, and many others.

The library supports the creation of new DateTime objects with either UTC or custom timezone specifications, ensuring that you always have accurate and relevant date and time information. Additionally, it provides a mechanism to validate input dates and times, ensuring that you always have accurate information to work with.

Features ✨

The library DateTime provides date and time types and methods to make it easier to manipulate dates and times. It uses the serde library to derive the Deserialize and Serialize traits to convert the DateTime struct to and from various data formats. It also uses the time and regex crates to deal with time conversions and regular expressions respectively.

The DateTime struct includes fields such as:

Feature Description
day Day of the month: (01-31)
hour Hour of the day: (00-23)
iso_8601 ISO 8601 date and time: (e.g. "2023-01-01T00:00:00+00:00")
iso_week ISO week number: (1-53)
microsecond Microsecond: (0-999999)
minute Minute of the hour: (0-59)
month Month: (e.g. "January")
now Now object: (e.g. "2023-01-01")
offset Offset from UTC: (e.g. "+00:00")
ordinal Ordinal date: (1-366)
second Second of the minute: (0-59)
time Time object: (e.g. "00:00:00")
tz Time zone object: (e.g. "UTC")
weekday Weekday object: (e.g. "Monday")
year Year object: (e.g. "2023")

Each of which represents different aspects of a date and time.

The DateTime struct has two methods to create instances: new and new_with_tz. new creates a new DateTime object with UTC timezone, and new_with_tz creates a new DateTime object with a custom timezone.

It also includes a method is_valid_day which checks if the input string represents a valid day of the week. It also includes a method is_valid_month which checks if the input string represents a valid month of the year.

Getting Started 🚀

It takes just a few seconds to get up and running with DateTime.

Installation

To install DateTime, you need to have the Rust toolchain installed on your machine. You can install the Rust toolchain by following the instructions on the Rust website.

Once you have the Rust toolchain installed, you can install DateTime using the following command:

cargo install dtt

Requirements

The minimum supported Rust toolchain version is currently Rust 1.67.1 or later (stable).

Platform support

DateTime is supported and has been tested on the following platforms:

FreeBSD targets đŸŦ

Target Description Status
x86_64-unknown-freebsd 64-bit FreeBSD on x86-64 ✅ Tested

Linux targets 🐧

Target Description Status
aarch64-unknown-linux-gnu 64-bit Linux systems on ARM architecture ✅ Tested
aarch64-unknown-linux-musl 64-bit Linux systems on ARM architecture ✅ Tested
arm-unknown-linux-gnueabi ARMv6 Linux (kernel 3.2, glibc 2.17) ✅ Tested
armv7-unknown-linux-gnueabihf ARMv7 Linux, hardfloat (kernel 3.2, glibc 2.17) ✅ Tested
i686-unknown-linux-gnu 32-bit Linux (kernel 3.2+, glibc 2.17+) ✅ Tested
i686-unknown-linux-musl 32-bit Linux (kernel 3.2+, musl libc) ✅ Tested
x86_64-unknown-linux-gnu 64-bit Linux (kernel 2.6.32+, glibc 2.11+) ✅ Tested
x86_64-unknown-linux-musl 64-bit Linux (kernel 2.6.32+, musl libc) ✅ Tested

Illumos targets 🌞

Target Description Status
x86_64-unknown-illumos 64-bit Illumos on x86-64 ✅ Tested

macOS targets 🍎

Target Description Status
aarch64-apple-darwin 64-bit macOS on Apple Silicon ✅ Tested
x86_64-apple-darwin 64-bit macOS (10.7 Lion or later) ✅ Tested

The GitHub Actions shows the platforms in which the DateTime library tests are run.

Should you encounter any issues with the library on any of the above platforms, please report a bug. We will do our best to resolve the issue as soon as possible. If you would like to contribute to help us to support additional platforms, please submit a pull request.

Documentation

â„šī¸ Info: Do check out our website for more information and find our documentation on docs.rs, lib.rs and crates.io.

Usage 📖

To use DateTime in your project, add the following to your Cargo.toml file:

[dependencies]
dtt = "0.0.3"

Add the following to your main.rs file:

extern crate dtt;
use dtt::*;

then you can use the functions in your application code.

Examples

DateTime comes with a set of examples that you can use to get started. The examples are located in the examples directory of the project. To run the examples, clone the repository and run the following command in your terminal from the project root directory.

cargo run --example dtt

Semantic Versioning Policy đŸšĨ

For transparency into our release cycle and in striving to maintain backward compatibility, DateTime follows semantic versioning.

License 📝

The project is licensed under the terms of both the MIT license and the Apache License (Version 2.0).

Contribution 🤝

We welcome all people who want to contribute. Please see the contributing instructions for more information.

Contributions in any form (issues, pull requests, etc.) to this project must adhere to the Rust's Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Acknowledgements 💙

A big thank you to all the awesome contributors of DateTime (DTT) for their help and support. A special thank you goes to the Rust Reddit community for providing a lot of useful suggestions on how to improve this project.