plone.app.z3cform/thet-dateinputtype: Change the input type for date fields to date and for dateti
Johannes Raggam <jenkins-z4DKO/[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Repository: plone.app.z3cform Branch: refs/heads/thet-dateinputtype Date: 2017-07-14T12:34:56+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: https://github.com/plone/plone.app.z3cform/commit/1d8cc890557e7e25f0f21111f8946589cb49c548 Change the input type for date fields to date and for datetime fields to datetime-local. Files changed: M CHANGES.rst M plone/app/z3cform/widget.py diff --git a/CHANGES.rst b/CHANGES.rst index 9cf4569..e056fba 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,7 +10,8 @@ Breaking changes: New features: -- *add item here* +- Change the input type for date fields to ``date`` and for datetime fields to ``datetime-local``. + [thet] Bug fixes: diff --git a/plone/app/z3cform/widget.py b/plone/app/z3cform/widget.py index 0409d44..5bed826 100644 --- a/plone/app/z3cform/widget.py +++ b/plone/app/z3cform/widget.py @@ -146,6 +146,7 @@ def _base_args(self): args['name'] = self.name args['value'] = (self.request.get(self.name, self.value) or u'').strip() + args['type'] = 'date' args.setdefault('pattern_options', {}) if self.field.required: @@ -220,6 +221,8 @@ def _base_args(self): if args['value'] and len(args['value'].split(' ')) == 1: args['value'] += ' 00:00' + args['type'] = 'datetime-local' + args.setdefault('pattern_options', {}) if 'time' in args['pattern_options']: # Time gets set in parent class to false. Remove. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot