Skip to content

Commit

Permalink
feat: used the shared ssn function for birthday (#2941)
Browse files Browse the repository at this point in the history
  • Loading branch information
rikuke committed Apr 18, 2024
1 parent d7ac20a commit 84e7ca7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/benefit/applications/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import date, datetime
from datetime import date

from dateutil.relativedelta import relativedelta
from django.conf import settings
Expand Down Expand Up @@ -34,6 +34,7 @@
from common.localized_iban_field import LocalizedIBANField
from common.utils import DurationMixin
from companies.models import Company
from shared.common.utils import social_security_number_birthdate
from shared.models.abstract_models import TimeStampedModel, UUIDModel
from users.models import User

Expand Down Expand Up @@ -863,7 +864,7 @@ def birthday(self):
return None
# invalid social security number results in ValueError.
# input validation should ensure it's always valid.
return datetime.strptime(self.social_security_number[:6], "%d%m%y").date()
return social_security_number_birthdate(self.social_security_number)

def __str__(self):
return "{} {} ({})".format(self.first_name, self.last_name, self.email)
Expand Down

0 comments on commit 84e7ca7

Please sign in to comment.