vitalets / x-editable

In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
http://vitalets.github.io/x-editable
MIT License
6.51k stars 1.73k forks source link

Usage of html5-date field #1149

Open MartinWeidner opened 4 years ago

MartinWeidner commented 4 years ago

Hi, i need the possibilty to show the default html5-date field when inline editing? is that possible? is there a workaround?

i tried the usage of textfield with custom tpl:

$('.editable-date').editable({ type: 'text', tpl: '<input type="date">', });

But now, I have another issue. The date for input field musst be in format yyyy-mm-dd, but before editing it must shown in german format (dd.mm.yyyy). How can I make this possible?

thanks in advance

MartinWeidner commented 4 years ago

Ok, I found a workaround:

            $('.editable-date').editable({
                type: 'text',
                tpl: '<input type="date">',
                display: function (value) {
                    var german_date = value.split("-");
                    $(this).text(german_date[2] + "." + german_date[1] + "." + german_date[0]);
                },
            });

But it would be still nice to have html5-date out of the box.

Thanks in advance