Skip to content

Commit

Permalink
fix date lookback
Browse files Browse the repository at this point in the history
  • Loading branch information
bck01215 committed Aug 1, 2024
1 parent 7cb7993 commit 98dd34e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "elasticnow"
version = "0.5.1"
version = "0.5.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
11 changes: 4 additions & 7 deletions src/cli/args.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use crate::cli::config::get_config_dir;
use crate::elasticnow::servicenow_structs::SysIdResult;
use ansi_term::Colour;
use chrono::{Datelike, Local};
use chrono::{Datelike, Duration, Local};
use clap::{Command, CommandFactory, Parser, Subcommand};
use clap_complete::{generate, Generator, Shell};
use dialoguer::{theme::ColorfulTheme, Select};
use std::{collections::HashMap, io};

#[derive(Parser)]
#[command(name = "elasticnow", about = "ElasticNow time tracking CLI", version)]
pub struct Args {
Expand Down Expand Up @@ -198,12 +199,8 @@ pub fn get_today() -> String {

pub fn get_week_start() -> String {
let now = Local::now();
format!(
"{}-{:02}-{:02}",
now.year(),
now.month(),
now.day() - now.weekday().num_days_from_monday()
)
let now = now - Duration::days(now.weekday().num_days_from_monday() as i64);
format!("{}-{:02}-{:02}", now.year(), now.month(), now.day())
}

pub fn pretty_print_time_worked(time_worked: HashMap<String, i64>, top: usize, total: i64) {
Expand Down

0 comments on commit 98dd34e

Please sign in to comment.