Skip to content

Commit

Permalink
fix: correct getting months for -3
Browse files Browse the repository at this point in the history
  • Loading branch information
quite authored and b1rger committed Aug 31, 2024
1 parent 04e8f60 commit 7cdeda0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ extern crate clap;
extern crate serde;
extern crate toml;
extern crate xdg;
use chrono::Duration;
use std::process;

use context::Context;
Expand Down Expand Up @@ -42,8 +41,16 @@ fn main() {
let mut daterangeend: chrono::NaiveDate = ctx.usersetdate.last_day_of_month();

if ctx.opts.three {
daterangebegin = (ctx.usersetdate - Duration::weeks(4)).first_day_of_month();
daterangeend = (ctx.usersetdate + Duration::weeks(4)).last_day_of_month();
daterangebegin = ctx
.usersetdate
.first_day_of_month()
.pred_opt()
.unwrap()
.first_day_of_month();
daterangeend = ctx
.usersetdate
.first_day_of_next_month()
.last_day_of_month();
months.push(daterangebegin);
months.push(ctx.usersetdate);
months.push(daterangeend);
Expand Down

0 comments on commit 7cdeda0

Please sign in to comment.