Skip to content

date

Calendar dates without time zones: validation, ISO 8601 text, weekdays and day arithmetic.

A Date is a plain year-month-day in the proleptic Gregorian calendar, limited to the years 0..=9999. Nothing here reads the clock or knows about time zones: convert a unix time to a day count and pass it in.

Cargo feature date (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features date

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.6", default-features = false, features = ["date"] }

Import path: helpers4::date.

ItemWhat it does
DateA calendar date (year, month, day) in the proleptic Gregorian calendar, with no time of day and no time zone.
days_in_monthThe number of days in month of year.
is_leap_yearWhether year is a leap year in the Gregorian calendar.
WeekdayA day of the week, Monday first (ISO 8601).

Documented on the page of the helper that returns them.

TypeReturned by
DateErrorDate