Skip to content

Commit

Permalink
Merge pull request #1726 from lamassu/release-10.0
Browse files Browse the repository at this point in the history
Release 10.0
  • Loading branch information
RafaelTaranto authored Oct 14, 2024
2 parents b25f3d1 + 72f934f commit 38b8209
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
14 changes: 3 additions & 11 deletions new-lamassu-admin/src/pages/Customers/CustomerData.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Grid from '@material-ui/core/Grid'
import { makeStyles } from '@material-ui/core/styles'
import { parse, format } from 'date-fns/fp'
import * as R from 'ramda'
import { useState, React } from 'react'
import * as Yup from 'yup'
Expand Down Expand Up @@ -30,6 +29,7 @@ import {
customerDataElements,
customerDataSchemas,
formatDates,
tryFormatDate,
getFormattedPhone
} from './helper.js'

Expand Down Expand Up @@ -113,18 +113,10 @@ const CustomerData = ({
firstName: R.path(['firstName'])(idData) ?? '',
lastName: R.path(['lastName'])(idData) ?? '',
documentNumber: R.path(['documentNumber'])(idData) ?? '',
dateOfBirth:
(rawDob &&
format('yyyy-MM-dd')(parse(new Date(), 'yyyyMMdd', rawDob))) ??
'',
dateOfBirth: tryFormatDate(rawDob),
gender: R.path(['gender'])(idData) ?? '',
country: R.path(['country'])(idData) ?? '',
expirationDate:
(rawExpirationDate &&
format('yyyy-MM-dd')(
parse(new Date(), 'yyyyMMdd', rawExpirationDate)
)) ??
''
expirationDate: tryFormatDate(rawExpirationDate)
},
usSsn: {
usSsn: customer.usSsn ?? ''
Expand Down
22 changes: 16 additions & 6 deletions new-lamassu-admin/src/pages/Customers/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,22 @@ const requirementElements = {
}
}

const tryFormatDate = rawDate => {
try {
return (
(rawDate &&
format('yyyy-MM-dd')(parse(new Date(), 'yyyyMMdd', rawDate))) ??
''
)
} catch (err) {
return ''
}
}

const formatDates = values => {
R.map(
elem =>
(values[elem] = format('yyyyMMdd')(
parse(new Date(), 'yyyy-MM-dd', values[elem])
))
)(['dateOfBirth', 'expirationDate'])
R.forEach(elem => {
values[elem] = tryFormatDate(values[elem])
})(['dateOfBirth', 'expirationDate'])
return values
}

Expand Down Expand Up @@ -579,6 +588,7 @@ export {
customerDataElements,
customerDataSchemas,
formatDates,
tryFormatDate,
REQUIREMENT,
CUSTOM,
ID_CARD_DATA
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "lamassu-server",
"description": "bitcoin atm client server protocol module",
"keywords": [],
"version": "10.0.3-beta.3",
"version": "10.0.3",
"license": "./LICENSE",
"author": "Lamassu (https://lamassu.is)",
"dependencies": {
Expand Down

0 comments on commit 38b8209

Please sign in to comment.