Group transactions by locale TZ (#1883)
This commit is contained in:
parent
43287dd018
commit
e9bc89488f
|
@ -22,7 +22,7 @@ import {
|
||||||
import { UPDATE_TRANSACTION_DETAILS } from 'src/logic/safe/store/actions/fetchTransactionDetails'
|
import { UPDATE_TRANSACTION_DETAILS } from 'src/logic/safe/store/actions/fetchTransactionDetails'
|
||||||
|
|
||||||
import { AppReduxState } from 'src/store'
|
import { AppReduxState } from 'src/store'
|
||||||
import { getUTCStartOfDate } from 'src/utils/date'
|
import { getLocalStartOfDate } from 'src/utils/date'
|
||||||
import { sameString } from 'src/utils/strings'
|
import { sameString } from 'src/utils/strings'
|
||||||
import { sortObject } from 'src/utils/objects'
|
import { sortObject } from 'src/utils/objects'
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ export const gatewayTransactions = handleActions<AppReduxState['gatewayTransacti
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTransactionSummary(value)) {
|
if (isTransactionSummary(value)) {
|
||||||
const startOfDate = getUTCStartOfDate(value.transaction.timestamp)
|
const startOfDate = getLocalStartOfDate(value.transaction.timestamp)
|
||||||
|
|
||||||
if (typeof history[startOfDate] === 'undefined') {
|
if (typeof history[startOfDate] === 'undefined') {
|
||||||
history[startOfDate] = []
|
history[startOfDate] = []
|
||||||
|
|
|
@ -20,6 +20,12 @@ export const getUTCStartOfDate = (timestamp: number): number => {
|
||||||
return Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0, 0)
|
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 formatWithSchema = (timestamp: number, schema: string): string => format(timestamp, schema)
|
||||||
|
|
||||||
export const formatTime = (timestamp: number): string => formatWithSchema(timestamp, 'h:mm a')
|
export const formatTime = (timestamp: number): string => formatWithSchema(timestamp, 'h:mm a')
|
||||||
|
|
Loading…
Reference in New Issue