Home

Awesome

Date Time Image

DateTimeNr Library README

Overview

DateTimeNr is a specialized library tailored for Noir. Essential in blockchain and cryptographic applications, it offers precise and efficient handling of date and time data.

Features

ZKP Context

In ZKPs and blockchain:

Usage Examples

Date and Time Parsing

let date = parse_date(2024, 12, 31);
let time = parse_time(23, 59, 59, 0);

Formatting

let formatted_date = format_date(date);
let formatted_time = format_time(time);

Time Zone Conversion

let time_utc = parse_time(15, 0, 0, 0);
let time_est = convert_time_zone(time_utc, -5);

Arithmetic Operations

let date = parse_date(2021, 1, 1);
let new_date = add_to_date(date, 1, 0, 0);
let time = parse_time(11, 30, 0, 0);
let new_time = add_time(time, 1, 30, 0);

Leap Year

let leap_2020 = is_leap_year(2020);
let leap_2019 = is_leap_year(2019);

Month Handling

let feb_2020_days = days_in_month(2020, 2);
let feb_2019_days = days_in_month(2019, 2);

Date Components Adjustment

let date = parse_date(2021, 12, 15);
let new_date = adjust_month(date, 2);
let another_date = adjust_day(date, -10);

Subtracting Dates/Times

let new_date = subtract_from_date(date, 1, 0, 0);
let new_time = subtract_time(time, 2, 0, 0);

Date Difference

let start_date = parse_date(2021, 1, 1);
let end_date = parse_date(2021, 12, 31);
let difference = date_difference(start_date, end_date);

Limitations

Testing

Features robust tests for accuracy and reliability.

Contributing

Contributions are welcome! Feel free to submit pull requests or issues.

License

Distributed under Apache License 2.0. See LICENSE for details.