#year #leap #is-leap-year #get-days-in-month

no-std year-helper

This library provides some useful functions to deal with years

4 releases

0.2.1 Jan 6, 2023
0.2.0 Dec 30, 2022
0.1.1 Dec 30, 2022
0.1.0 Dec 27, 2022

#473 in Date and time

Download history 69/week @ 2024-09-17 111/week @ 2024-09-24 65/week @ 2024-10-01 114/week @ 2024-10-08 73/week @ 2024-10-15 118/week @ 2024-10-22 183/week @ 2024-10-29 128/week @ 2024-11-05 147/week @ 2024-11-12 115/week @ 2024-11-19 201/week @ 2024-11-26 208/week @ 2024-12-03 195/week @ 2024-12-10 149/week @ 2024-12-17 114/week @ 2024-12-24 51/week @ 2024-12-31

531 downloads per month
Used in 4 crates (2 directly)

MIT license

5KB
51 lines

Year Helper

CI

This library provides some useful functions to deal with years.

Usage

let year = 2020;
let month = 2;

let leap_year = year_helper::is_leap_year(year);

let days_in_month = year_helper::get_days_in_month(year, month);
let days_in_year = year_helper::get_days_in_year(year);

// or use the following functions if the year has been determined whether it is a leap year
let days_in_month = year_helper::get_days_in_month_2(leap_year, month);
let days_in_year = year_helper::get_days_in_year_2(leap_year);

Crates.io

https://crates.io/crates/year-helper

Documentation

https://docs.rs/year-helper

License

MIT


lib.rs:

Year Helper

This library provides some useful functions to deal with years.

Usage

let year = 2020;
let month = 2;

let leap_year = year_helper::is_leap_year(year);

let days_in_month = year_helper::get_days_in_month(year, month);
let days_in_year = year_helper::get_days_in_year(year);

// or use the following functions if the year has been determined whether it is a leap year
let days_in_month = year_helper::get_days_in_month_2(leap_year, month);
let days_in_year = year_helper::get_days_in_year_2(leap_year);

No runtime deps