fix(main): stopping past tracking with hour while stopped
This commit is contained in:
parent
86010962a2
commit
2e76250edc
2 changed files with 4 additions and 2 deletions
|
@ -86,7 +86,7 @@ pub fn parse_date_with_ref(str: &str, reference: DateTime<Local>) -> Option<Date
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Turn a human-readable relative timestamp into a nostr Timestamp.
|
/// Turn a human-readable relative timestamp into a nostr Timestamp.
|
||||||
/// - Plain number as hour, 18 hours back or 6 hours forward
|
/// - Plain number as hour after given date, if none 18 hours back or 6 hours forward
|
||||||
/// - Number with prefix as minute offset
|
/// - Number with prefix as minute offset
|
||||||
/// - Otherwise try to parse a relative date
|
/// - Otherwise try to parse a relative date
|
||||||
pub fn parse_tracking_stamp(str: &str, after: Option<DateTime<Local>>) -> Option<Timestamp> {
|
pub fn parse_tracking_stamp(str: &str, after: Option<DateTime<Local>>) -> Option<Timestamp> {
|
||||||
|
|
|
@ -640,7 +640,9 @@ async fn main() -> Result<()> {
|
||||||
match arg {
|
match arg {
|
||||||
None => tasks.move_to(None),
|
None => tasks.move_to(None),
|
||||||
Some(arg) => {
|
Some(arg) => {
|
||||||
if parse_tracking_stamp(arg, Local.timestamp_millis_opt(tasks.get_position_timestamped().0.as_u64() as i64 * 1000).earliest())
|
let pos = tasks.get_position_timestamped();
|
||||||
|
let time = pos.1.and_then(|_| Local.timestamp_millis_opt(pos.0.as_u64() as i64 * 1000).earliest());
|
||||||
|
if parse_tracking_stamp(arg, time)
|
||||||
.and_then(|stamp| tasks.track_at(stamp, None)).is_some() {
|
.and_then(|stamp| tasks.track_at(stamp, None)).is_some() {
|
||||||
println!("{}", tasks.times_tracked(15));
|
println!("{}", tasks.times_tracked(15));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue