1 use standback::convert::TryFrom;
2 
3 // (year, ordinal)
4 #[derive(serde::Serialize, serde::Deserialize)]
5 pub(crate) struct Date(pub(crate) i32, pub(crate) u16);
6 
7 impl From<crate::Date> for Date {
from(original: crate::Date) -> Self8     fn from(original: crate::Date) -> Self {
9         Self(original.year(), original.ordinal())
10     }
11 }
12 
13 impl TryFrom<Date> for crate::Date {
14     type Error = &'static str;
15 
try_from(original: Date) -> Result<Self, Self::Error>16     fn try_from(original: Date) -> Result<Self, Self::Error> {
17         Self::try_from_yo(original.0, original.1).map_err(|_| "invalid value")
18     }
19 }
20