[FIX] survey: fix date picker template and validation
The date picker widget was set to text instead of date. Then we needed to fix the date validation at form submit. opw 1890130 closes odoo/odoo#27448
This commit is contained in:
@@ -134,7 +134,7 @@ if(!the_form.length) {
|
||||
var date_fields = $form.find('div.date > input.form-control');
|
||||
for (var i=0; i < date_fields.length; i++) {
|
||||
var el = date_fields[i];
|
||||
var moment_date = $(el).data('DateTimePicker').date();
|
||||
var moment_date = moment(el.value);
|
||||
if (moment_date) {
|
||||
moment_date.toJSON = function () {
|
||||
return this.clone().locale('en').format('YYYY-MM-DD');
|
||||
|
||||
@@ -238,7 +238,7 @@
|
||||
|
||||
<template id="date" name="Date box">
|
||||
<div class='input-group date'>
|
||||
<input type="text" date="true" class="form-control date" t-att-name="prefix"/>
|
||||
<input type="date" class="form-control" t-att-name="prefix"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user