Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 0cd524c

Browse files
author
schnogz
committed
fix moment double date parsing/formatting issue
1 parent 9253d26 commit 0cd524c

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

packages/blockchain-wallet-v4-frontend/src/data/components/exchangeHistory/model.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import moment from 'moment'
21
import { difference, has, propOr, values } from 'ramda'
32

43
import { splitPair } from 'data/modules/rates/model'
54

65
export const PER_PAGE = 20
7-
8-
export const DATE_FORMAT = 'DD MMMM YYYY, HH:mm'
9-
106
export const ETH_AIRDROP_MODAL = '@EXCHANGE.ETH_AIRDROP_MODAL'
117
export const RESULTS_MODAL = '@EXCHANGE.RESULTS_MODAL'
128

@@ -50,7 +46,7 @@ export const formatExchangeTrade = ({
5046
return {
5147
id,
5248
status: state,
53-
date: moment(createdAt).format(DATE_FORMAT),
49+
date: createdAt,
5450
sourceCoin,
5551
targetCoin,
5652
depositAmount: propOr('', 'value', deposit),

packages/blockchain-wallet-v4-frontend/src/scenes/ExchangeHistory/List/TradeItem/selectors.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import moment from 'moment'
21
import { ifElse } from 'ramda'
32

43
import { getCoinFromPair } from 'services/ShapeshiftService'
54
import { model } from 'data'
65

76
const {
8-
DATE_FORMAT,
97
formatExchangeTrade,
108
isShapeShiftTrade
119
} = model.components.exchangeHistory
@@ -17,7 +15,7 @@ const formatShapeshiftTrade = trade => {
1715

1816
return {
1917
status,
20-
date: moment(timestamp).format(DATE_FORMAT),
18+
date: timestamp,
2119
sourceCoin,
2220
targetCoin,
2321
deposit,

packages/blockchain-wallet-v4-frontend/src/scenes/ExchangeHistory/List/TradeItem/template.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types'
44
import { FormattedMessage } from 'react-intl'
55
import moment from 'moment'
66
import { pathOr } from 'ramda'
7+
78
import { model } from 'data'
89
import { TableCell, TableRow, Text, Link } from 'blockchain-info-components'
910
import { selectColor, OrderStatus } from 'components/OrderStatus'
@@ -20,13 +21,10 @@ const StatusContainer = styled(TableCell)`
2021

2122
const { FINISHED } = model.components.exchangeHistory.STATES
2223

23-
const tradeDateHelper = (date, isMobile = false) => {
24-
let timeFormat = 'MMMM D YYYY @ h:mm A'
25-
if (isMobile) timeFormat = 'DD MMM'
26-
return moment(date)
24+
const tradeDateHelper = (date, isMobile = false) =>
25+
moment(date)
2726
.local()
28-
.format(timeFormat)
29-
}
27+
.format(isMobile ? 'DD MMM' : 'MMMM D YYYY @ h:mm A')
3028

3129
const TradeItem = props => {
3230
const {

0 commit comments

Comments
 (0)