Skip to content

Conversation

@Zangetsu101
Copy link
Contributor

@Zangetsu101 Zangetsu101 commented Oct 13, 2025

Description

  • A new type of field AGE which stores both the input value and a reference date as { age: number; asOfDate: string }
  • Support for nested field in conditionals
  • Helpers for age fields asAge and asDob

countryconfig: opencrvs/opencrvs-countryconfig#1089

Checklist

  • I have linked the correct Github issue under "Development"
  • I have tested the changes locally, and written appropriate tests
  • I have tested beyond the happy path (e.g. edge cases, failure paths)
  • I have updated the changelog with this change (if applicable)
  • I have updated the GitHub issue status accordingly

@github-actions
Copy link

Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:

  • Changelog is read by country implementors who might not always be familiar with all technical details of OpenCRVS. Keep language high-level, user friendly and avoid technical references to internals.
  • Answer "What's new?", "Why was the change made?" and "Why should I care?" for each change.
  • If it's a breaking change, include a migration guide answering "What do I need to do to upgrade?".

@Zangetsu101 Zangetsu101 added the Skip e2e Helps run lint/unit test only for faster feedback. Remove before merge. label Oct 13, 2025
Comment on lines -75 to -78
export const getAllUniqueFields = (eventConfig: EventConfig) => {
return uniqBy(getDeclarationFields(eventConfig), (field) => field.id)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was a duplicate function

Comment on lines -376 to -377
inPast: () => defineFormConditional(getDayRange(days, 'before')),
inFuture: () => defineFormConditional(getDayRange(-days, 'before'))
Copy link
Contributor Author

@Zangetsu101 Zangetsu101 Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inPast should have used -days and vice versa

{label && (
<InputLabel
id={`${id}_label`}
htmlFor={id}
Copy link
Contributor Author

@Zangetsu101 Zangetsu101 Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should allow searching for input fields via label text in tests

// This was previously cast on FormSectionComponent level.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
errors={formikProps.errors as any}
errors={formikProps.errors}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍


export const AgeField = {
Input: AgeInput,
Output: ({ value }: { value?: AgeValue }) => value?.age ?? ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the <Output/> simply display the age, or also the asOfDate?

E.g. 'Age: 20 years (on 14th Oct 2025)'

I guess it could also be configurable how the Output should look like. In any case, it doesn't need to be part of this PR if it's not needed yet.

@cibelius
Copy link
Contributor

Nice work 💯 Left a couple of thoughts

Copy link
Contributor

@cibelius cibelius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also allow prefix, as some languages might have the 'years' before the number

@Zangetsu101 Zangetsu101 removed the Skip e2e Helps run lint/unit test only for faster feedback. Remove before merge. label Oct 15, 2025
@ocrvs-bot
Copy link
Contributor

Your environment is deployed to https://ocrvs-10351.e2e-k8s.opencrvs.dev

@Zangetsu101 Zangetsu101 enabled auto-merge (squash) October 16, 2025 04:52
@Zangetsu101 Zangetsu101 merged commit a285ddc into develop Oct 16, 2025
121 of 124 checks passed
@Zangetsu101 Zangetsu101 deleted the ocrvs-10351 branch October 16, 2025 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants