wetter/wetter/utils.py

13 lines
249 B
Python

#!/usr/bin/env python3
from datetime import datetime
def fromisoformat(str):
return datetime.strptime(str, '%Y-%m-%d').date()
def toisoformat(str, alt=""):
try:
return fromisoformat(str).isoformat()
except:
return alt