plomino / Plomino

Powerful and flexible web-based application builder
33 stars 37 forks source link

pickadate Jquery datetime widget doesn't work with a non default date format #765

Closed ivanteoh closed 8 years ago

ivanteoh commented 8 years ago

Problem

If you set the datetime widget to have a format such as '%d %B %Y' , the format is not passed to the pickadate js. The consequence is that it misinterprets the date. If you hit save you might change the date to another one.

Internal

datetime_edit.pt doesn't pass the format info to pickadate. It can support passing the format info but its a different kind of format definition from pyhon http://amsul.ca/pickadate.js/date/#formatting-rules and https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior

If you look at mockup/patterns/pickadate/pattern.js and mockup/patterns/querystring/pattern.js, it is possible to accept format variable in data-pat-pickadate. for example, {"time": false, "date": {"format": "dd mmmm yyyy" }}.

Options

[ ] disable 'JQuery datetime widget' [ ] send formatting to pickadate. convert python date format to pickadate format. [ ] Set a constant format so that JQuery widget will understand the datetime format

Getting the right value

correct

Getting the wrong value

wrong
ebrehault commented 8 years ago

I guess option 2 would be the best, but if too complex we might go with option 3.