[MTELELIE-314]fix -70 years
This commit is contained in:
parent
115624a34f
commit
0e987d8b20
|
@ -3,6 +3,7 @@ import re
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
from dateutil.relativedelta import relativedelta
|
||||||
from django import template
|
from django import template
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
from wcs.qommon import misc
|
from wcs.qommon import misc
|
||||||
|
@ -80,7 +81,10 @@ def get_birthday_from_nn(numero_national):
|
||||||
"""
|
"""
|
||||||
numero_national = clean_string(numero_national)
|
numero_national = clean_string(numero_national)
|
||||||
date = numero_national[:6]
|
date = numero_national[:6]
|
||||||
return datetime.datetime.strptime(date, "%y%m%d")
|
birthday = datetime.datetime.strptime(date, "%y%m%d")
|
||||||
|
if birthday > datetime.datetime.now():
|
||||||
|
birthday -= relativedelta(years=100)
|
||||||
|
return birthday
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
|
|
Loading…
Reference in New Issue