Skip to content

Commit

Permalink
Merge pull request #922 from opencrvs/ocrvs-6530
Browse files Browse the repository at this point in the history
Fix regex of dob fields
  • Loading branch information
rikukissa authored Feb 29, 2024
2 parents f92d992 + 647dee2 commit e75aea2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/api/content/client/descriptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@
"home.header.placeHolderBrnDrn": "Search menu brn drn place holder",
"home.header.placeHolderPhone": "Search menu phone no place holder",
"home.header.placeHolderNationalId": "Search menu national ID place holder",
"home.header.placeHolderId": "Search menu ID place holder",
"home.header.placeHolderEmail": "Search menu email place holder",
"home.header.systemTitle": "System title",
"home.header.settingsTitle": "settings title",
Expand Down
4 changes: 2 additions & 2 deletions src/form/custom-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export function getReasonForLateRegistration(
}
const expression: string =
event === 'birth'
? 'const pattern = /^\\d{4}-\\d{2}-\\d{2}$/; const today = new Date(); const eventDatePlusLateRegistrationTarget = new Date(values.childBirthDate); const lateRegistrationTarget = offlineCountryConfig && offlineCountryConfig.config.BIRTH.LATE_REGISTRATION_TARGET; eventDatePlusLateRegistrationTarget.setDate(eventDatePlusLateRegistrationTarget.getDate() + lateRegistrationTarget); !pattern.test(values.childBirthDate) || today < eventDatePlusLateRegistrationTarget;'
: 'const pattern = /^\\d{4}-\\d{2}-\\d{2}$/; const today = new Date(); const eventDatePlusLateRegistrationTarget = new Date(values.deathDate); const lateRegistrationTarget = offlineCountryConfig && offlineCountryConfig.config.DEATH.REGISTRATION_TARGET; eventDatePlusLateRegistrationTarget.setDate(eventDatePlusLateRegistrationTarget.getDate() + lateRegistrationTarget); !pattern.test(values.deathDate) || today < eventDatePlusLateRegistrationTarget;'
? 'const pattern = /^\\d{4}-\\d{1,2}-\\d{1,2}$/; const today = new Date(); const eventDatePlusLateRegistrationTarget = new Date(values.childBirthDate); const lateRegistrationTarget = offlineCountryConfig && offlineCountryConfig.config.BIRTH.LATE_REGISTRATION_TARGET; eventDatePlusLateRegistrationTarget.setDate(eventDatePlusLateRegistrationTarget.getDate() + lateRegistrationTarget); !pattern.test(values.childBirthDate) || today < eventDatePlusLateRegistrationTarget;'
: 'const pattern = /^\\d{4}-\\d{1,2}-\\d{1,2}$/; const today = new Date(); const eventDatePlusLateRegistrationTarget = new Date(values.deathDate); const lateRegistrationTarget = offlineCountryConfig && offlineCountryConfig.config.DEATH.REGISTRATION_TARGET; eventDatePlusLateRegistrationTarget.setDate(eventDatePlusLateRegistrationTarget.getDate() + lateRegistrationTarget); !pattern.test(values.deathDate) || today < eventDatePlusLateRegistrationTarget;'

return {
name: fieldName,
Expand Down

0 comments on commit e75aea2

Please sign in to comment.