Skip to content

Commit

Permalink
add Date and Time input elements (#608)
Browse files Browse the repository at this point in the history
Add `form.Date` and `form.Time` elements.
  • Loading branch information
jimgregory committed Jun 5, 2020
1 parent 16de314 commit ee8a3f5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions web/form.py
Expand Up @@ -520,6 +520,38 @@ def get_type(self):
return "email"


class Date(Input):
"""Date input.
Note: Not supported by desktop Safari, Internet Explorer, or Opera Mini
See: <https://html.spec.whatwg.org/#date-state-(type=date)>
>>> Date(name='date', value='2020-04-01').render()
u'<input id="date" name="date" type="date" value="2020-04-01"/>'
"""

def get_type(self):
return "date"


class Time(Input):
"""Time input.
Note: Not supported by desktop Safari, Internet Explorer, or Opera Mini
See: <https://html.spec.whatwg.org/#time-state-(type=time)>
>>> Time(name='time', value='07:00').render()
u'<input id="time" name="time" type="time" value="07:00"/>'
"""

def get_type(self):
return "time"


class Search(Input):
"""Search input.
Expand Down

0 comments on commit ee8a3f5

Please sign in to comment.