From e9bc89488f64386840e52dd56206710af7a15270 Mon Sep 17 00:00:00 2001 From: Fernando Date: Thu, 11 Feb 2021 05:17:56 -0300 Subject: [PATCH] Group transactions by locale TZ (#1883) --- src/logic/safe/store/reducer/gatewayTransactions.ts | 4 ++-- src/utils/date.ts | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/logic/safe/store/reducer/gatewayTransactions.ts b/src/logic/safe/store/reducer/gatewayTransactions.ts index 8037fa90..df347f4c 100644 --- a/src/logic/safe/store/reducer/gatewayTransactions.ts +++ b/src/logic/safe/store/reducer/gatewayTransactions.ts @@ -22,7 +22,7 @@ import { import { UPDATE_TRANSACTION_DETAILS } from 'src/logic/safe/store/actions/fetchTransactionDetails' import { AppReduxState } from 'src/store' -import { getUTCStartOfDate } from 'src/utils/date' +import { getLocalStartOfDate } from 'src/utils/date' import { sameString } from 'src/utils/strings' import { sortObject } from 'src/utils/objects' @@ -78,7 +78,7 @@ export const gatewayTransactions = handleActions { return Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0, 0) } +export const getLocalStartOfDate = (timestamp: number): number => { + const date = new Date(timestamp) + + return date.setHours(0, 0, 0, 0) +} + export const formatWithSchema = (timestamp: number, schema: string): string => format(timestamp, schema) export const formatTime = (timestamp: number): string => formatWithSchema(timestamp, 'h:mm a')