From cf22c4eba238109a0e3703e2efa190cd3b68817f Mon Sep 17 00:00:00 2001
From: matograine <tom.ngr@zaclys.net>
Date: Mon, 26 Apr 2021 17:05:30 +0200
Subject: [PATCH] [mod] #344 use pendulum in tx_history

---
 silkaj/tx_history.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/silkaj/tx_history.py b/silkaj/tx_history.py
index aa5b409c..92e0e6b5 100644
--- a/silkaj/tx_history.py
+++ b/silkaj/tx_history.py
@@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
 along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
 """
 
+from pendulum import from_timestamp
 from click import command, argument, option, echo_via_pager, get_terminal_size
 from texttable import Texttable
 from operator import itemgetter, neg, eq, ne
@@ -25,11 +26,12 @@ from duniterpy.documents.transaction import Transaction
 
 from silkaj.network_tools import ClientInstance
 from silkaj.tools import coroutine
-from silkaj.tui import convert_time, display_pubkey_and_checksum
+from silkaj.tui import display_pubkey_and_checksum
 from silkaj.crypto_tools import validate_checksum, check_pubkey_format
 from silkaj import wot
 from silkaj.money import get_amount_from_pubkey, amount_in_current_base, UDValue
 from silkaj.tools import CurrencySymbol
+from silkaj.constants import ALL_DIGITAL
 
 
 @command("history", help="Display transaction history")
@@ -72,7 +74,7 @@ Current balance: {balance} {currency}, {balance_ud} UD {currency} on the {date}\
         currency=currency_symbol,
         balance=balance[1] / 100,
         balance_ud=round(balance[1] / ud_value, 2),
-        date=convert_time(time(), "all"),
+        date=from_timestamp(time()).format(ALL_DIGITAL),
     )
 
 
@@ -150,7 +152,7 @@ async def parse_received_tx(
     identities = await wot.identities_from_pubkeys(issuers, uids)
     for received_tx in received_txs:
         tx_list = list()
-        tx_list.append(convert_time(received_tx.time, "all"))
+        tx_list.append(from_timestamp(received_tx.time).format(ALL_DIGITAL))
         tx_list.append(str())
         for i, issuer in enumerate(received_tx.issuers):
             tx_list[1] += prefix(None, None, i) + assign_idty_from_pubkey(
@@ -182,7 +184,7 @@ async def parse_sent_tx(sent_txs_table, sent_txs, pubkey, ud_value, uids, full_p
     identities = await wot.identities_from_pubkeys(pubkeys, uids)
     for sent_tx in sent_txs:
         tx_list = list()
-        tx_list.append(convert_time(sent_tx.time, "all"))
+        tx_list.append(from_timestamp(sent_tx.time).format(ALL_DIGITAL))
 
         total_amount, outputs = tx_amount(sent_tx, pubkey, sent_func)
         if len(outputs) > 1:
-- 
GitLab