Skip to content

Commit 898808a

Browse files
Merge pull request #280 from SwissBitcoinPay/fix-wrong-create-time
Fixed invalid date/time in History
2 parents 17c4abc + 2a72506 commit 898808a

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/hooks/usePostInvoice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export const usePostInvoice = () => {
171171
{
172172
id: id,
173173
status: "open",
174-
time: Math.round(new Date().getTime() / 1000),
174+
createdAt: Math.round(new Date().getTime() / 1000),
175175
input: {
176176
unit: unit || currency,
177177
amount: decimalFiat

src/screens/History/History.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ export const History = () => {
137137
title: data.defaultDescription,
138138
status: data.status || "open",
139139
tag: "withdraw",
140-
time: localTransactionsHistory[index].time || 0,
140+
createdAt:
141+
localTransactionsHistory[index].createdAt ||
142+
localTransactionsHistory[index].time ||
143+
0,
141144
amount:
142145
localTransactionsHistory[index]?.amount || data.minWithdrawable
143146
} as InvoiceWithLnurlUrl;
@@ -206,7 +209,7 @@ export const History = () => {
206209
const satsTotal =
207210
transactions.reduce((result, transaction) => {
208211
if (
209-
(transaction.time || 0) < startOfToday ||
212+
(transaction.createdAt || 0) < startOfToday ||
210213
transaction.amount <= 0 ||
211214
transaction.status !== "settled"
212215
) {
@@ -339,7 +342,7 @@ export const History = () => {
339342
];
340343

341344
return {
342-
title: `${timeFormatter.format((transaction.time || 0) * 1000)}`,
345+
title: `${timeFormatter.format((transaction.createdAt || 0) * 1000)}`,
343346
disabled:
344347
(isPaid && transaction.tag === "withdraw") ||
345348
isExpired ||

0 commit comments

Comments
 (0)