Print dates in a nicer format

This commit is contained in:
Joscha 2021-12-06 13:54:58 +00:00
parent 531a140c45
commit 3e70b2e2c9
5 changed files with 67 additions and 5 deletions

View file

@ -28,13 +28,19 @@ fn main() -> anyhow::Result<()> {
let range = DateRange::new(
NaiveDate::from_ymd(2021, 1, 1),
NaiveDate::from_ymd(2021, 12, 31),
NaiveDate::from_ymd(2022, 12, 31),
)
.unwrap();
println!("{:#?}", files.eval(EntryMode::Relevant, range));
for entry in files.eval(EntryMode::Relevant, range)? {
let title = files.command(entry.source).title();
if let Some(dates) = entry.dates {
println!("{:36} - {}", format!("{}", dates), title);
} else {
println!("{:36} - {}", "undated", title);
}
}
files.mark_all_dirty();
files.save()?;
Ok(())
}