From b774de1ae4491b3fea5a389501646025e80364b5 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 14 Aug 2023 16:22:23 +0100 Subject: [PATCH] Formate the transaction created date withouth timestamp --- src/libs/TransactionUtils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js index 92b83e7b8735..76cb47f2a444 100644 --- a/src/libs/TransactionUtils.js +++ b/src/libs/TransactionUtils.js @@ -1,4 +1,5 @@ import Onyx from 'react-native-onyx'; +import {format} from 'date-fns'; import lodashGet from 'lodash/get'; import _ from 'underscore'; import CONST from '../CONST'; @@ -151,9 +152,9 @@ function getCurrency(transaction) { function getCreated(transaction) { const created = lodashGet(transaction, 'modifiedCreated', ''); if (created) { - return created; + return format(new Date(created), CONST.DATE.FNS_FORMAT_STRING); } - return lodashGet(transaction, 'created', ''); + return format(new Date(lodashGet(transaction, 'created', '')), CONST.DATE.FNS_FORMAT_STRING) } export {buildOptimisticTransaction, getUpdatedTransaction, getTransaction, getDescription, getAmount, getCurrency, getCreated};