11 lines
282 B
Python
11 lines
282 B
Python
from fastapi import HTTPException
|
|
|
|
from .datetime import tz_aware_now
|
|
|
|
|
|
def get_now_in_view(zone: str = 'UTC'):
|
|
try:
|
|
now = tz_aware_now(zone=zone)
|
|
except ValueError:
|
|
raise HTTPException(status_code=400, detail=f'Zone "{zone}" is unsupported')
|
|
return now
|