From 858bcc3c12e15b699e0d575a55066558ed4b1e97 Mon Sep 17 00:00:00 2001 From: Beka Lewis Date: Tue, 25 Jul 2023 10:07:23 +0100 Subject: [PATCH] Change NI to 14 day postal vote reg deadline --- tests/elections/test_local.py | 9 +++++++++ uk_election_timetables/election.py | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/tests/elections/test_local.py b/tests/elections/test_local.py index 9e4dc86..b3ce60f 100644 --- a/tests/elections/test_local.py +++ b/tests/elections/test_local.py @@ -37,3 +37,12 @@ def test_postal_vote_application_deadline_local_election_england(): election = LocalElection(date(2021, 5, 6), country=Country.ENGLAND) assert election.postal_vote_application_deadline == date(2021, 4, 20) + + +# Reference election: local.belfast.2023-05-18 +def test_postal_vote_application_deadline_local_election_northern_ireland(): + deadline = LocalElection( + date(2023, 5, 18), country=Country.NORTHERN_IRELAND + ).postal_vote_application_deadline + + assert deadline == date(2023, 4, 26) diff --git a/uk_election_timetables/election.py b/uk_election_timetables/election.py index 0ede9a2..7b5ada1 100644 --- a/uk_election_timetables/election.py +++ b/uk_election_timetables/election.py @@ -23,8 +23,13 @@ def postal_vote_application_deadline(self) -> date: This is set out in `The Representation of the People (England and Wales) Regulations 2001 `_. + In Northern Ireland, this is set out in `The Representation of the People (Northern Ireland) Regulations 2008 ` + :return: a datetime representing the postal vote application deadline """ + if self.country == Country.NORTHERN_IRELAND: + return working_days_before(self.poll_date, 14, self._calendar()) + return working_days_before(self.poll_date, 11, self._calendar()) @property