Digitale bierlijst

util.py 240B

1234567891011
  1. import datetime
  2. from typing import Optional
  3. def fmt_datetime(x: Optional[datetime.datetime]) -> Optional[str]:
  4. """Format a datetime as ISO 8601, if it's not None."""
  5. if x is not None:
  6. return x.isoformat()
  7. return None