#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

#586 in Date and time

Download history 140/week @ 2026-01-19 158/week @ 2026-01-26 157/week @ 2026-02-02 170/week @ 2026-02-09 144/week @ 2026-02-16 128/week @ 2026-02-23 107/week @ 2026-03-02 153/week @ 2026-03-09 171/week @ 2026-03-16 146/week @ 2026-03-23 97/week @ 2026-03-30 86/week @ 2026-04-06 127/week @ 2026-04-13 151/week @ 2026-04-20 89/week @ 2026-04-27 45/week @ 2026-05-04

423 downloads per month
Used in 6 crates (3 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

No runtime deps