Add Date type
This commit is contained in:
parent
42b79bb0ee
commit
cc00e14cf7
2 changed files with 37 additions and 0 deletions
34
libimagtimeui/src/date.rs
Normal file
34
libimagtimeui/src/date.rs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
use chrono::naive::date::NaiveDate as ChronoNaiveDate;
|
||||||
|
|
||||||
|
use parse::Parse;
|
||||||
|
|
||||||
|
pub struct Date {
|
||||||
|
year: i32,
|
||||||
|
month: u32,
|
||||||
|
day: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Date {
|
||||||
|
|
||||||
|
fn new(year: i32, month: u32, day: u32) -> Date {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<ChronoNaiveDate> for Date {
|
||||||
|
|
||||||
|
fn into(self) -> ChronoNaiveDate {
|
||||||
|
ChronoNaiveDate::from_ymd(self.year, self.month, self.day)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Parse for Date {
|
||||||
|
|
||||||
|
fn parse(s: &str) -> Option<Date> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -4,3 +4,6 @@ extern crate regex;
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
|
|
||||||
#[macro_use] extern crate libimagerror;
|
#[macro_use] extern crate libimagerror;
|
||||||
|
|
||||||
|
pub mod date;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue