commit caf5a2e4344d368c834c8d00be84873248d843bc from: witcher date: Fri Jan 6 14:48:47 2023 UTC Verify recurring amount is at least 1 commit - 921165feb60b35f5fff3c8ca30107a3fb5273c46 commit + caf5a2e4344d368c834c8d00be84873248d843bc blob - 14c752717f17798ba89ae5070c6cc6291d9f41c8 blob + 486f07c6fa14e952d651a804ec4d8c6ab195da37 --- src/parser.rs +++ src/parser.rs @@ -166,7 +166,10 @@ fn time_unit(i: &str) -> IResult<&str, TimeUnit> { fn time_amount(i: &str) -> IResult<&str, TimeAmount> { map( - tuple((map_res(digit1, str::parse::), time_unit)), + tuple(( + verify(map_res(digit1, str::parse::), |d: &usize| *d > 0), + time_unit, + )), |(amount, unit)| TimeAmount::new(amount, unit), )(i) }