11 lines
226 B
Python
11 lines
226 B
Python
|
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()
|