diff options
| author | Alexandre Kühn <aku@odoo.com> | 2017-12-04 11:01:36 +0100 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2017-12-05 09:13:31 +0100 |
| commit | 6cc5a9963b3cce5d6ddf2cd038def5fe21f17af7 (patch) | |
| tree | 31ec78e726c4965485bfa875c7374678f8f548dc /addons/website_form/static | |
| parent | 59729695680b33a1eec8e170777e07ee12cb3925 (diff) | |
[FIX] web,*: time format from user's language
Before this fix, the chatter always showed dates of messages in military time format.
This was not the expected behavior, as the user could have had customize
the date and time format in the settings of the current language.
Steps to reproduce the issue:
1. Set Odoo in English
2. Settings > Translations > Languages > English
2.1. Set Date Format to %m/%d/%Y
2.2. Set Time Format to %I:%M:%S %p
3. CRM > (Select any opportunity with at least one message) > Mouse hover on elapsed time (e.g. "an hour ago")
Expected:
- It shows the customized time format (e.g. 11/07/2017 5:33:36 PM)
Results:
- It shows the military time format (e.g. Tue Nov 07 2017 17:33:36 GMT+0100)
opw-781647
Diffstat (limited to 'addons/website_form/static')
| -rw-r--r-- | addons/website_form/static/src/js/website_form.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/website_form/static/src/js/website_form.js b/addons/website_form/static/src/js/website_form.js index e98fae5e0ce..aa540650473 100644 --- a/addons/website_form/static/src/js/website_form.js +++ b/addons/website_form/static/src/js/website_form.js @@ -40,12 +40,12 @@ odoo.define('website_form.animation', function (require) { down: 'fa fa-chevron-down', }, locale : moment.locale(), - format : time.strftime_to_moment_format(l10n.date_format +' '+ l10n.time_format), + format : time.getLangDatetimeFormat(), }; this.$target.find('.o_website_form_datetime').datetimepicker(datepickers_options); // Adapt options to date-only pickers - datepickers_options.format = time.strftime_to_moment_format(l10n.date_format); + datepickers_options.format = time.getLangDateFormat(); this.$target.find('.o_website_form_date').datetimepicker(datepickers_options); return this._super.apply(this, arguments); @@ -209,8 +209,8 @@ odoo.define('website_form.animation', function (require) { // This is a stripped down version of format.js parse_value function parse_date: function (value, type_of_date, value_if_empty) { - var date_pattern = time.strftime_to_moment_format(_t.database.parameters.date_format), - time_pattern = time.strftime_to_moment_format(_t.database.parameters.time_format); + var date_pattern = time.getLangDateFormat(), + time_pattern = time.getLangTimeFormat(); var date_pattern_wo_zero = date_pattern.replace('MM','M').replace('DD','D'), time_pattern_wo_zero = time_pattern.replace('HH','H').replace('mm','m').replace('ss','s'); switch (type_of_date) { |
