Skip to content

Commit

Permalink
fix: added parsing of ocr date format to iso (#937)
Browse files Browse the repository at this point in the history
  • Loading branch information
chesterkmr authored Aug 22, 2023
1 parent 4684c8e commit 87d2683
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/kyb-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clsx": "^1.2.1",
"country-state-city": "^3.1.4",
"currency-codes": "^2.1.0",
"dayjs": "^1.11.6",
"form-data-encoder": "^3.0.0",
"i18n-iso-countries": "^7.6.0",
"ky": "^0.33.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import { BusinessData, TUser } from '@app/domains/collection-flow';
import { WorkflowFlowData } from '@app/domains/workflows/flow-data.type';
import { buildCompanyAddress } from '@app/pages/CollectionFlow/components/organisms/KYBView/flows/BaseFlow/helpers/serialize-business-data';
import { traverseObjectAndPickValue } from '@app/utils/traverse-object-and-pick-value';
import dayjs from 'dayjs';

export const selectBusinessData = ({ flowData }: WorkflowFlowData, user: TUser): BusinessData => {
const dateOfIncorporation = traverseObjectAndPickValue('registrationDate', flowData, null);

const businessData: BusinessData = {
industry: traverseObjectAndPickValue('industry', flowData, ''),
website: traverseObjectAndPickValue('website', flowData, ''),
Expand All @@ -12,7 +15,9 @@ export const selectBusinessData = ({ flowData }: WorkflowFlowData, user: TUser):
registrationNumber: traverseObjectAndPickValue('registrationNumber', flowData, ''),
country: '',
countryOfIncorporation: traverseObjectAndPickValue('companyCountry', flowData, ''),
dateOfIncorporation: traverseObjectAndPickValue('registrationDate', flowData, null),
dateOfIncorporation: dateOfIncorporation
? dayjs(dateOfIncorporation).toISOString()
: dateOfIncorporation,
address: buildCompanyAddress(traverseObjectAndPickValue('headquarters', flowData, {}) as any),
phoneNumber: '',
email: user.email,
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 87d2683

Please sign in to comment.