didier/database/utils/datetime.py

16 lines
446 B
Python
Raw Normal View History

import datetime
import zoneinfo
__all__ = ["LOCAL_TIMEZONE", "today_only_date"]
LOCAL_TIMEZONE = zoneinfo.ZoneInfo("Europe/Brussels")
def today_only_date() -> datetime.datetime:
2022-07-30 18:27:58 +02:00
"""Mongo can't handle datetime.date, so we need a datetime instance
We do, however, only care about the date, so remove all the rest
"""
2022-07-30 18:27:58 +02:00
today = datetime.date.today()
return datetime.datetime(year=today.year, month=today.month, day=today.day)