Add support for a configuration file
This commit is contained in:
parent
a34dbb7fd3
commit
b9664b43c8
10 changed files with 505 additions and 63 deletions
|
@ -1,7 +1,7 @@
|
|||
use std::{fs, path::PathBuf};
|
||||
|
||||
use anyhow::Result;
|
||||
use chrono::{Datelike, NaiveDate};
|
||||
use color_eyre::eyre::{ContextCompat, Result};
|
||||
use log::*;
|
||||
use uuid::Uuid;
|
||||
use vcard4::{
|
||||
|
@ -81,17 +81,15 @@ pub async fn sync_date_of_birth(
|
|||
fn vcard_date_to_naive_date(src: DateAndOrTime) -> Result<NaiveDate> {
|
||||
match src {
|
||||
DateAndOrTime::Date(date) => {
|
||||
Ok(
|
||||
NaiveDate::from_ymd_opt(date.year(), date.month() as u32, date.day().into())
|
||||
.expect(&format!("Unable to parse {}", date)),
|
||||
)
|
||||
NaiveDate::from_ymd_opt(date.year(), date.month() as u32, date.day().into())
|
||||
.wrap_err("Unable to parse a date")
|
||||
}
|
||||
DateAndOrTime::DateTime(datetime) => Ok(NaiveDate::from_ymd_opt(
|
||||
DateAndOrTime::DateTime(datetime) => NaiveDate::from_ymd_opt(
|
||||
datetime.year(),
|
||||
datetime.month() as u32,
|
||||
datetime.day().into(),
|
||||
)
|
||||
.expect(&format!("Unable to parse {}", datetime))),
|
||||
.wrap_err("Unable to parse a datetime"),
|
||||
DateAndOrTime::Time(_time) => todo!(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue