Skip to content
Snippets Groups Projects
Commit d8244c64 authored by Nasreddin (bon)'s avatar Nasreddin (bon) Committed by Nasreddin Boulif (bon)
Browse files

[FIX] survey: display right date format in datepicker


Issue

	- Install 'Survey' & 'website' module
	- Enable "es_VE" language and activate on main website
	- Go to Website Homepage
	- Switch to "Spanish (VE)" language (footer)
	- Go to "Survey" module
	- Create a survey:
	- Add a question of type 'Date' then save
	- Click on "TEST" button
	- Start survey and add a date with the datepicker
	- Submit survey

	Error message : 'This is not a date'

Cause

	When submit survey, not using the database date format.

Solution

	When validating form (on submit), check if date is formated
	with database format and (not the moment locale since user can
	alter date and datetime format).

opw-2452237

closes odoo/odoo#71228

X-original-commit: f3c5dd79
Signed-off-by: default avatarAnh Thao PHAM <kitan191@users.noreply.github.com>
Signed-off-by: default avatarbon-odoo <nboulif@users.noreply.github.com>
parent 507408e8
Branches
Tags
No related merge requests found
......@@ -589,7 +589,8 @@ publicWidget.registry.SurveyFormWidget = publicWidget.Widget.extend({
if (questionRequired && !data[questionId]) {
errors[questionId] = constrErrorMsg;
} else if (data[questionId]) {
var momentDate = moment($input.val());
var datetimepickerFormat = $input.data('questionType') === 'datetime' ? time.getLangDatetimeFormat() : time.getLangDateFormat();
var momentDate = moment($input.val(), datetimepickerFormat);
if (!momentDate.isValid()) {
errors[questionId] = validationDateMsg;
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment