change transactions and utxos csv export to use utc timezone for dates

This commit is contained in:
Craig Raw 2024-04-16 10:35:42 +02:00
parent 5a0df265bc
commit 0fed7c45ee
2 changed files with 6 additions and 2 deletions

View file

@ -31,6 +31,10 @@ public class WalletTransactions implements WalletExport {
private final WalletForm walletForm;
static {
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
}
public WalletTransactions(WalletForm walletForm) {
this.walletForm = walletForm;
}
@ -72,7 +76,7 @@ public class WalletTransactions implements WalletExport {
try {
CsvWriter writer = new CsvWriter(outputStream, ',', StandardCharsets.UTF_8);
writer.write("Date");
writer.write("Date (UTC)");
writer.write("Label");
writer.write("Value");
writer.write("Balance");

View file

@ -480,7 +480,7 @@ public class UtxosController extends WalletFormController implements Initializab
if(file != null) {
try(FileOutputStream outputStream = new FileOutputStream(file)) {
CsvWriter writer = new CsvWriter(outputStream, ',', StandardCharsets.UTF_8);
writer.writeRecord(new String[] {"Date", "Output", "Address", "Label", "Value"});
writer.writeRecord(new String[] {"Date (UTC)", "Output", "Address", "Label", "Value"});
for(Entry entry : getWalletForm().getWalletUtxosEntry().getChildren()) {
UtxoEntry utxoEntry = (UtxoEntry)entry;
writer.write(utxoEntry.getBlockTransaction().getDate() == null ? "Unconfirmed" : WalletTransactions.DATE_FORMAT.format(utxoEntry.getBlockTransaction().getDate()));