mirror of
https://github.com/skoelle/icloud-contacts-sync.git
synced 2026-09-17 23:40:24 +00:00
birthday unknown year filter
This commit is contained in:
@@ -24,6 +24,7 @@ from api.auth import get_current_user, resolve_account_for_user
|
||||
from api.schemas import ContactListResponse, ContactOut, SyncRunOut
|
||||
from config import Config
|
||||
from mailer import build_message, fetch_birthdays_for_date, send_message
|
||||
from utils import fmt_birthday_age, fmt_birthday_short
|
||||
|
||||
logging.basicConfig(level=Config.LOG_LEVEL, format="%(asctime)s [%(levelname)s] %(message)s")
|
||||
logger = logging.getLogger("api")
|
||||
@@ -33,6 +34,8 @@ app.add_middleware(SessionMiddleware, secret_key=secrets.token_hex(32), session_
|
||||
app.mount("/static", StaticFiles(directory="api/static"), name="static")
|
||||
templates = Jinja2Templates(directory="api/templates")
|
||||
templates.env.filters["urlquote"] = lambda s: quote_plus(s or "")
|
||||
templates.env.filters["fmt_birthday"] = fmt_birthday_short
|
||||
templates.env.filters["fmt_age"] = fmt_birthday_age
|
||||
|
||||
|
||||
def _fmt_ts(dt) -> str | None:
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
{% if contact.birthday %}
|
||||
<div class="section">
|
||||
<div class="birthday-highlight">
|
||||
🎂 {{ contact.birthday }}
|
||||
🎂 {{ contact.birthday|fmt_birthday }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -367,7 +367,7 @@
|
||||
<div class="birthday-organization">{{ b.organization }}</div>
|
||||
{% endif %}
|
||||
<div class="birthday-date">
|
||||
{{ b.birthday.strftime('%d.%m.') }}{% if b.birthday.year and b.birthday.year < current_year %} · {{ current_year - b.birthday.year }} Jahre{% endif %}
|
||||
{{ b.birthday|fmt_birthday }}{% if b.birthday|fmt_age %} · {{ b.birthday|fmt_age(current_year) }} Jahre{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if b.photo_url %}
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
<div class="contact-organization">{{ c.organization }}</div>
|
||||
{% endif %}
|
||||
{% if c.birthday %}
|
||||
<div class="contact-birthday">{{ c.birthday }}</div>
|
||||
<div class="contact-birthday">{{ c.birthday|fmt_birthday }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div style="display:flex;flex-direction:column;align-items:center;gap:0.3rem">
|
||||
|
||||
Reference in New Issue
Block a user