Luke Tainton
f611b685b3
* fix(config): return None if env var is empty or non-existent * chore: fix pylint issues * fix: add unit test for non-existent env vars
19 lines
438 B
Python
19 lines
438 B
Python
"""Provides functions for converting timestamps to dates."""
|
|
|
|
from datetime import datetime
|
|
from zoneinfo import ZoneInfo
|
|
|
|
|
|
def timestamp_to_date(timestamp: int) -> str:
|
|
"""Convert timestamp to date.
|
|
|
|
Args:
|
|
timestamp (int): Timestamp to convert.
|
|
|
|
Returns:
|
|
str: Date in the format YYYY-MM-DD.
|
|
"""
|
|
return datetime.fromtimestamp(timestamp=timestamp, tz=ZoneInfo("UTC")).strftime(
|
|
"%Y-%m-%d"
|
|
)
|