hledger-flow: btcpayserver: add local timezone support

This commit is contained in:
2025-03-05 02:39:12 -08:00
parent 338053e0db
commit 99c7075742
2 changed files with 26 additions and 6 deletions

View File

@@ -77,13 +77,29 @@ function btcpayserver::legacy()
if (NR<2 || $1 !~ global_year)
next
printf $1 OFS # ReceivedDate
# ReceivedDate (w/ local timezone added)
sub(/ /, "T", $1) # HACK: makes arg-friendly by removing space
cmd = "date \"+%F %T %z\" --date="$1 | getline date
printf date OFS
printf $2 OFS # StoreId
printf $3 OFS # OrderId
printf $4 OFS # InvoiceId
printf $5 OFS # InvoiceCreatedDate
printf $6 OFS # InvoiceExpirationDate
printf $7 OFS # InvoiceMonitoringDate
# InvoiceCreatedDate (w/ local timezone added)
sub(/ /, "T", $5)
cmd = "date \"+%F %T %z\" --date="$5 | getline date
printf date OFS
# InvoiceExpirationDate (w/ local timezone added)
sub(/ /, "T", $6)
cmd = "date \"+%F %T %z\" --date="$6 | getline date
printf date OFS
# InvoiceMonitoringDate (w/ local timezone added)
sub(/ /, "T", $7)
cmd = "date \"+%F %T %z\" --date="$7 | getline date
printf date OFS
# PaymentId
# NOTE: BTCPay Server will append the block index as "-N" to the txid
@@ -160,7 +176,11 @@ function btcpayserver::wallets()
if ($6 !~ /^-/)
next
printf $1 OFS # Date (ReceivedDate)
# Date (ReceivedDate w/ local timezone added)
sub(/ /, "T", $1) # HACK: makes arg-friendly by removing space
cmd = "date \"+%F %T %z\" --date="$1 | getline date
printf date OFS
printf OFS # (StoreId)
printf OFS # (OrderId)
printf $4 OFS # InvoiceId (InvoiceId)

View File

@@ -19,7 +19,7 @@
fields ReceivedDate,StoreId,OrderId,InvoiceId,InvoiceCreatedDate,InvoiceExpirationDate,InvoiceMonitoringDate,txid,index,Destination,PaymentType,CryptoCode,Paid,NetworkFee,ConversionRate,PaidCurrency,InvoiceCurrency,InvoiceDue,InvoicePrice,InvoiceItemCode,InvoiceItemDesc,InvoiceFullStatus,InvoiceStatus,InvoiceExceptionStatus,BuyerEmail,Accounted,direction,subaccount
# NOTE: BTCPayServer exports to localtime
date-format %Y-%m-%d %H:%M:%S
date-format %Y-%m-%d %H:%M:%S %z
date %ReceivedDate
description %ReceivedDate