From 6d7f02227af3bc872c6864b19c691dd4da5d8ffe Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Tue, 27 Feb 2024 15:35:26 +0200 Subject: [PATCH] add seconds to date column for transactions and utxos csv export --- .../com/sparrowwallet/sparrow/io/WalletTransactions.java | 6 ++++-- .../com/sparrowwallet/sparrow/wallet/UtxosController.java | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/io/WalletTransactions.java b/src/main/java/com/sparrowwallet/sparrow/io/WalletTransactions.java index c9b3438d..d3435e79 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/WalletTransactions.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/WalletTransactions.java @@ -10,7 +10,6 @@ import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.WalletModel; import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.UnitFormat; -import com.sparrowwallet.sparrow.control.EntryCell; import com.sparrowwallet.sparrow.net.ExchangeSource; import com.sparrowwallet.sparrow.wallet.Entry; import com.sparrowwallet.sparrow.wallet.TransactionEntry; @@ -21,11 +20,14 @@ import org.apache.commons.lang3.time.DateUtils; import java.io.IOException; import java.io.OutputStream; import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; public class WalletTransactions implements WalletExport { private static final long ONE_DAY = 24*60*60*1000L; + public static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private final WalletForm walletForm; @@ -83,7 +85,7 @@ public class WalletTransactions implements WalletExport { for(Entry entry : walletTransactionsEntry.getChildren()) { TransactionEntry txEntry = (TransactionEntry)entry; - writer.write(txEntry.getBlockTransaction().getDate() == null ? "Unconfirmed" : EntryCell.DATE_FORMAT.format(txEntry.getBlockTransaction().getDate())); + writer.write(txEntry.getBlockTransaction().getDate() == null ? "Unconfirmed" : DATE_FORMAT.format(txEntry.getBlockTransaction().getDate())); writer.write(txEntry.getLabel()); writer.write(getCoinValue(bitcoinUnit, txEntry.getValue())); writer.write(getCoinValue(bitcoinUnit, txEntry.getBalance())); diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/UtxosController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/UtxosController.java index 29b514b6..98e4d432 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/UtxosController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/UtxosController.java @@ -18,6 +18,7 @@ import com.sparrowwallet.sparrow.event.*; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; import com.sparrowwallet.sparrow.io.Config; import com.sparrowwallet.sparrow.io.Storage; +import com.sparrowwallet.sparrow.io.WalletTransactions; import com.sparrowwallet.sparrow.net.ExchangeSource; import com.sparrowwallet.sparrow.whirlpool.Whirlpool; import com.sparrowwallet.sparrow.whirlpool.WhirlpoolDialog; @@ -482,7 +483,7 @@ public class UtxosController extends WalletFormController implements Initializab writer.writeRecord(new String[] {"Date", "Output", "Address", "Label", "Value"}); for(Entry entry : getWalletForm().getWalletUtxosEntry().getChildren()) { UtxoEntry utxoEntry = (UtxoEntry)entry; - writer.write(utxoEntry.getBlockTransaction().getDate() == null ? "Unconfirmed" : EntryCell.DATE_FORMAT.format(utxoEntry.getBlockTransaction().getDate())); + writer.write(utxoEntry.getBlockTransaction().getDate() == null ? "Unconfirmed" : WalletTransactions.DATE_FORMAT.format(utxoEntry.getBlockTransaction().getDate())); writer.write(utxoEntry.getHashIndex().toString()); writer.write(utxoEntry.getAddress().getAddress()); writer.write(utxoEntry.getLabel());