Skip to content
Snippets Groups Projects
Commit dcd79a54 authored by Aurélien Warnon's avatar Aurélien Warnon
Browse files

[FIX] survey: fix empty date in survey could not be submitted

Purpose
=======

A date field not marked as "mandatory" could not be left blank in the survey.

That was caused by the form returning "Invalid date" instead of an
empty value when submitting.

closes odoo/odoo#30788
parent 13e058c5
Branches
Tags
No related merge requests found
......@@ -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 = moment(el.value);
var moment_date = el.value !== '' ? moment(el.value) : '';
if (moment_date) {
moment_date.toJSON = function () {
return this.clone().locale('en').format('YYYY-MM-DD');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment