Skip to content

feat(soci): fill in the birth date from the codice fiscale - #160

Merged
BIA3IA merged 1 commit into
mainfrom
feat/soci-birth-date-from-cf
Nov 12, 2026
Merged

BIA3IA merged 1 commit into
mainfrom
feat/soci-birth-date-from-cf

Conversation

@toto04

@toto04 toto04 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

In the Soci forms (Admit socio, Register account, Edit details), typing a valid codice fiscale now sets the Birth date it encodes.

  • The code keeps only two digits of the year. The century is the latest one that doesn't put the birth after today, so on 2026-11-12 80 → 1980, 05 → 2005, and 26S30 → 1926-11-30.
  • Nothing happens until the code is valid (format and check character), so a half-typed code never touches the date.
  • If the date already agrees with the code (same day, month and two-digit year, e.g. 1925 typed by hand), it's kept. A date that doesn't match is replaced.
  • The field stays editable, with the hint "Filled in from the codice fiscale." The existing mismatch error and the backend's check are unchanged.

The logic is in src/features/soci/codice-fiscale-birth.ts, kept apart from codice-fiscale.ts because that file is a copy of the backend's. Tests are in tests/soci.test.mjs, covering omocodia, 29 February, the century rollover and invalid codes.

pnpm check, pnpm typecheck, pnpm test and pnpm build pass.

Typing a valid codice fiscale in Admit, Register or Edit sets the birth date it
encodes. The code keeps only two digits of the year, so the century is the
latest that doesn't put the birth after today. A date that already agrees with
the code (e.g. one a century earlier, typed by hand) is kept, and the field
stays editable.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds helpers to derive a birth date from a codice fiscale and updates the Soci form to recalculate the draft birth date when the codice fiscale changes. The birth-date field also always references its hint.

Changes

Soci birth-date autofill

Layer / File(s) Summary
Birth-date derivation and retention rules
src/features/soci/codice-fiscale-birth.ts, tests/soci.test.mjs
birthDateOf resolves a valid encoded date using century candidates that do not exceed today. birthDateFor keeps a valid matching date or returns the derived date. Tests cover century selection, omocodia, invalid dates and codes, and keeping, filling, or replacing a date.
Form update and birth-date hint
src/features/soci/socio-form.tsx
The codice fiscale change handler updates the draft birth date through birthDateFor. The birth-date field declares that it is filled from the codice fiscale and always references its hint ID.

Possibly related issues

  • PoliNetworkOrg/admin issue 144 — It concerns the admit form’s codice fiscale and birth-date fields. This change autofills the birth date but does not implement the issue’s Phase 2 dialog.

Possibly related PRs

Change: Feature

Merge Risk: Minimal · up to 88e6a

This change fills in the birth date from a valid codice fiscale in the socio forms. No actionable merge-blocking risk remains in the supplied context.

Pre-merge checks: Passed 3

Check name Status Explanation
Title check Passed The title "feat(soci): fill in the birth date from the codice fiscale" names the main change. The PR adds birth-date autofill from a valid codice fiscale in the soci forms, and the summary confirms th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(soci): fill in the birth date from the codice fiscale" names the main change. The PR adds birth-date autofill from a valid codice fiscale in the soci forms, and the summary confirms the new birthDateOf and birthDateFor functions and the form hint. The title is specific and concise, and it follows a conventional commit style.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d123a3c3-76d8-4ce0-a41e-ffe080bb5864
Commits

Reviewing files that changed from the base of the PR and between 9b45563 and 88e6a07.

Files selected for processing: 3

  • src/features/soci/codice-fiscale-birth.ts
  • src/features/soci/socio-form.tsx
  • tests/soci.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@BIA3IA
BIA3IA merged commit 9138ef1 into main Nov 12, 2026
2 checks passed
@BIA3IA
BIA3IA deleted the feat/soci-birth-date-from-cf branch November 12, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants