Browse Source

fix age

master
Igor Elpin 2 years ago
parent
commit
517c760d4f
  1. 3
      humans/__init__.py
  2. 2
      templates/index.html

3
humans/__init__.py

@ -18,7 +18,8 @@ class AbstractHuman:
@property
def age(self) -> int:
age=datetime.now().year-self.birthday.year
today=datetime.now()
age=today.year-self.birthday.year -((today.month, today.day) < (self.birthday.month, self.birthday.day))
if age>0:
return int(age)
else:

2
templates/index.html

@ -51,7 +51,7 @@
<td>
<div class="nes-balloon from-right is-dark">
<p>Игорь Ельпин(говорит):
Игорь Ельпин. Мужчина 1989-11-16 (33 полных лет)
Игорь Ельпин. Мужчина 1989-11-16
</p>
</div>
<div class="nes-balloon from-right is-dark">

Loading…
Cancel
Save