Format transaction amounts on output

This might want to use the same YNAB CSV format as `convert`.
This commit is contained in:
2026-06-03 09:20:12 +02:00
parent 14d0d82719
commit f7b645895d
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -171,7 +171,7 @@ async fn main() -> anyhow::Result<()> {
};
println!("Transactions{} in the last 30 days:", accountstr);
for t in transactions {
println!("{},{},{}", t.date, t.payee, t.amount);
println!("{},{},{}", t.date, t.payee, t.format_amount());
}
Ok(())
+1 -1
View File
@@ -32,7 +32,7 @@ impl Transaction {
})
}
fn format_amount(&self) -> String {
pub fn format_amount(&self) -> String {
let whole = self.amount / 10 / 100;
let frac = if self.amount < 0 { -1 } else { 1 } * (self.amount / 10) % 100;
format!("{}.{:02}", whole, frac)