Show future birthdays
This commit is contained in:
parent
26e194c20b
commit
0a33c069b0
|
@ -3,6 +3,7 @@
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
from rich.pretty import pprint
|
||||||
|
|
||||||
from .types import Event
|
from .types import Event
|
||||||
|
|
||||||
|
@ -28,12 +29,13 @@ def get_birthdays(from_date: date, filepath: str) -> list[Event]:
|
||||||
for entity in entities:
|
for entity in entities:
|
||||||
birthday = date(**entity["birthday"])
|
birthday = date(**entity["birthday"])
|
||||||
bday, age = next_birthday(from_date, birthday)
|
bday, age = next_birthday(from_date, birthday)
|
||||||
events.append(
|
for offset in range(2):
|
||||||
Event(
|
events.append(
|
||||||
date=bday,
|
Event(
|
||||||
name="birthday",
|
date=bday.replace(year=bday.year + offset),
|
||||||
title=f'{entity["label"]} (aged {age})',
|
name="birthday",
|
||||||
|
title=f'{entity["label"]} (aged {age + offset})',
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
return events
|
return events
|
||||||
|
|
Loading…
Reference in a new issue