debusy/schedule/converters.py

11 lines
226 B
Python
Raw Normal View History

2020-04-13 11:59:45 +00:00
from datetime import date
class DateConverter:
regex = '[0-9]{4}-[0-9]{2}-[0-9]{2}'
def to_python(self, value):
return date.fromisoformat(value)
def to_url(self, value):
return value.isoformat()