You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #520 / PR #533, which aligned registration_date and the birthdate checks in spp_registry on fields.Date.context_today. The same server-date comparison remains at these sites (found in the #533 review, repo-wide grep on 19.0 @ 1a3c591). A user west of UTC is refused their own today after 00:00 UTC; a user east of UTC is refused a date they have already reached.
spp_programs/models/cycle.py:1355 — if record.start_date < fields.Date.today(): "The Start Date cannot be earlier than today." A user-picked date in a form; west of UTC the user's own today is refused. Arguably the most user-visible of the set.
Also noted in the same review (optional, same PR or separate)
spp_registry/models/registrant.py_check_registration_date: both error strings are not wrapped in _() and describe the boundary wrongly ("must be less than the current date" / "must be later than the birth date" while equality is accepted). Fix/362 birthdate not future #397 set the precedent of a translated message naming the record and the offending value.
spp_demo/models/demo_data_generator.py:381-385, 419-422 — dateto=fields.Date.today() for Faker's inclusive date_between_dates; hitting the end date is a ~1e-9 event, so purely tidiness, as Fix/362 birthdate not future #397 did for spp_mis_demo_v2.
spp_registry/models/individual.py:79 — the age compute uses fields.Datetime.now() (server), a different "today" than the constraint. Cosmetic: relativedelta clamps at 0 for a newborn born on the user's today east of UTC.
Fix
Per site: compare against fields.Date.context_today(record) (default: lambda self: fields.Date.context_today(self)), with tests on a frozen clock east and west of UTC as in spp_registry/tests/test_constraints.py::TestUserTodayAcrossTimezones. Each touched module needs its patch bump + HISTORY fragment.
Follow-up to #520 / PR #533, which aligned
registration_dateand the birthdate checks inspp_registryonfields.Date.context_today. The same server-date comparison remains at these sites (found in the #533 review, repo-wide grep on 19.0 @ 1a3c591). A user west of UTC is refused their own today after 00:00 UTC; a user east of UTC is refused a date they have already reached.Sites
spp_registry/models/phone_number.py:30-32, 46-49—date_collecteddefaults tofields.Date.todayand_check_date_collectedrefuses> fields.Date.today(). Same module and same registrant form as spp_registry: registration_date default and _birthdate_onchange still use the server date, refusing valid births east of UTC #520 (Phone Numbers tab). Secondary: it is an@api.onchangeraisingValidationError, so it is UI-only and ORM/API/import writes bypass it, the gap Fix/362 birthdate not future #397 closed forbirthdatewith a stored-field constraint.spp_programs/models/cycle.py:1355—if record.start_date < fields.Date.today(): "The Start Date cannot be earlier than today."A user-picked date in a form; west of UTC the user's own today is refused. Arguably the most user-visible of the set.spp_dci_client_crvs/models/crvs_event.py:154—event_date > fields.Date.today().spp_dci_client_dr/models/disability_status.py:129—assessment_date > fields.Date.today().Also noted in the same review (optional, same PR or separate)
spp_registry/models/registrant.py_check_registration_date: both error strings are not wrapped in_()and describe the boundary wrongly ("must be less than the current date" / "must be later than the birth date" while equality is accepted). Fix/362 birthdate not future #397 set the precedent of a translated message naming the record and the offending value.spp_demo/models/demo_data_generator.py:381-385, 419-422—dateto=fields.Date.today()for Faker's inclusivedate_between_dates; hitting the end date is a ~1e-9 event, so purely tidiness, as Fix/362 birthdate not future #397 did forspp_mis_demo_v2.spp_registry/models/individual.py:79— theagecompute usesfields.Datetime.now()(server), a different "today" than the constraint. Cosmetic:relativedeltaclamps at 0 for a newborn born on the user's today east of UTC.Fix
Per site: compare against
fields.Date.context_today(record)(default:lambda self: fields.Date.context_today(self)), with tests on a frozen clock east and west of UTC as inspp_registry/tests/test_constraints.py::TestUserTodayAcrossTimezones. Each touched module needs its patch bump + HISTORY fragment.