Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bug on AML and LTL when submit primaryId and secondaryId #243

Merged
merged 1 commit into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/aml-checklist/src/tests/badges/badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/aml-checklist/src/tests/badges/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/aml-checklist/src/utils/__tests__/datetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('daytime', () => {
const { identityDocument1, identityDocument2 } = idCheck
expect(result).toEqual({
...idCheck,
checkDate: '1-01-01',
checkDate: '1-01-01T00:00:00+00:00',
identityDocument1: {
...identityDocument1,
expiry: toLocalTime(identityDocument1?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.RFC3339),
Expand Down
34 changes: 22 additions & 12 deletions packages/aml-checklist/src/utils/datetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@ import { IdentityCheckModel } from '@reapit/foundations-ts-definitions'
*/
export const changeTimeZoneLocalForIdentityCheck = (identityChecks: IdentityCheckModel): IdentityCheckModel => {
const { identityDocument1, identityDocument2 } = identityChecks
return {
const newIdentity = {
...identityChecks,
identityDocument1: {
checkDate: toLocalTime(identityChecks.checkDate as dayjs.ConfigType, DATE_TIME_FORMAT.RFC3339),
}
if (identityDocument1) {
newIdentity.identityDocument1 = {
...identityDocument1,
expiry: toLocalTime(identityDocument1?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.RFC3339),
},
identityDocument2: {
}
}
if (identityDocument2) {
newIdentity.identityDocument2 = {
...identityDocument2,
expiry: toLocalTime(identityDocument2?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.RFC3339),
},
checkDate: toLocalTime(identityChecks.checkDate as dayjs.ConfigType, DATE_TIME_FORMAT.YYYY_MM_DD),
}
}
return newIdentity
}

/**
Expand All @@ -28,16 +33,21 @@ export const changeTimeZoneLocalForIdentityCheck = (identityChecks: IdentityChec
*/
export const changeTimeZoneUTCForIdentityCheck = (identityChecks: IdentityCheckModel): IdentityCheckModel => {
const { identityDocument1, identityDocument2 } = identityChecks
return {
const newIdentity = {
...identityChecks,
identityDocument1: {
checkDate: toUTCTime(identityChecks.checkDate as dayjs.ConfigType, DATE_TIME_FORMAT.YYYY_MM_DD),
}
if (identityDocument1) {
newIdentity.identityDocument1 = {
...identityDocument1,
expiry: toUTCTime(identityDocument1?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.YYYY_MM_DD),
},
identityDocument2: {
}
}
if (identityDocument2) {
newIdentity.identityDocument2 = {
...identityDocument2,
expiry: toUTCTime(identityDocument2?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.YYYY_MM_DD),
},
checkDate: toUTCTime(identityChecks.checkDate as dayjs.ConfigType, DATE_TIME_FORMAT.YYYY_MM_DD),
}
}
return newIdentity
}
2 changes: 1 addition & 1 deletion packages/elements/src/tests/badges/badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/elements/src/tests/badges/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/elements/src/tests/badges/badge-statements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/elements/src/utils/datetime/datetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export function closestTo(dateCompare: dayjs.ConfigType, datesArray: Array<dayjs
}

export function toUTCTime(value: dayjs.ConfigType, format: string | undefined = DATE_TIME_FORMAT.RFC3339): string {
if (!value) {
return ''
}
const date = dayjs(value)
return date.utc().format(format)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/lifetime-legal/src/tests/badges/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading