fix: guard against null expirationDate
fix: NaN age
This commit is contained in:
parent
0d88e6eba2
commit
3d8281fb73
1 changed files with 15 additions and 4 deletions
|
|
@ -116,16 +116,27 @@ const DetailsRow = ({ it: tx, timezone }) => {
|
||||||
const exchangeRate = BigNumber(fiat / crypto).toFormat(2)
|
const exchangeRate = BigNumber(fiat / crypto).toFormat(2)
|
||||||
const displayExRate = `1 ${tx.cryptoCode} = ${exchangeRate} ${tx.fiatCode}`
|
const displayExRate = `1 ${tx.cryptoCode} = ${exchangeRate} ${tx.fiatCode}`
|
||||||
|
|
||||||
|
const parseDateString = d => parse(new Date(), 'yyyyMMdd', d)
|
||||||
|
|
||||||
const customer = tx.customerIdCardData && {
|
const customer = tx.customerIdCardData && {
|
||||||
name: `${onlyFirstToUpper(
|
name: `${onlyFirstToUpper(
|
||||||
tx.customerIdCardData.firstName
|
tx.customerIdCardData.firstName
|
||||||
)} ${onlyFirstToUpper(tx.customerIdCardData.lastName)}`,
|
)} ${onlyFirstToUpper(tx.customerIdCardData.lastName)}`,
|
||||||
age: differenceInYears(tx.customerIdCardData.dateOfBirth, new Date()),
|
age:
|
||||||
|
(tx.customerIdCardData.dateOfBirth &&
|
||||||
|
differenceInYears(
|
||||||
|
parseDateString(tx.customerIdCardData.dateOfBirth),
|
||||||
|
new Date()
|
||||||
|
)) ??
|
||||||
|
'',
|
||||||
country: tx.customerIdCardData.country,
|
country: tx.customerIdCardData.country,
|
||||||
idCardNumber: tx.customerIdCardData.documentNumber,
|
idCardNumber: tx.customerIdCardData.documentNumber,
|
||||||
idCardExpirationDate: format('yyyy-MM-dd')(
|
idCardExpirationDate:
|
||||||
parse(new Date(), 'yyyyMMdd', tx.customerIdCardData.expirationDate)
|
(tx.customerIdCardData.expirationDate &&
|
||||||
)
|
format('yyyy-MM-dd')(
|
||||||
|
parseDateString(tx.customerIdCardData.expirationDate)
|
||||||
|
)) ??
|
||||||
|
''
|
||||||
}
|
}
|
||||||
|
|
||||||
const from = sub({ minutes: MINUTES_OFFSET }, tx.created)
|
const from = sub({ minutes: MINUTES_OFFSET }, tx.created)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue