pub struct Date { /* private fields */ }
Expand description
Implementations§
Source§impl Date
impl Date
Sourcepub fn new(year: u16, month: u8, day: u8) -> Self
pub fn new(year: u16, month: u8, day: u8) -> Self
Create a new Date
instance.
While it is called a date
, it is merely a shallow representation of
a day in time where a new release was cut. This release date
should not be used to perform operations on, and may not even be
valid in the Gregorian calendar. For example, a date 0-0-0
will
be accepted, but is not a valid month nor year for most parsers
which parse a Gregorian date.
It is up to the caller to make sure that the given date is valid. This library just takes a date representation “as-is”.
Sourcepub fn ymd(&self) -> impl Display
pub fn ymd(&self) -> impl Display
Prints a yyyy-mm-dd representation of a release date.
This representation may, just like Date
, be not a valid date
in the Gregorian calendar. The date is merely a representation.
Year, month, and day will all be pre-filled with 0’s. For year, at least four numbers are shown. For month and day, two.
Note that, a representation of 9999-200-200
is still possible, while
not valid as a Gregorian date.