[FIX] website_slides: display date in locale
In 10.0 since52f268d0some parts such as the date/datetime widget are adapted to the current locale and not just displayed in english. But the dates in the slides module are always in english because they don't wait for the locale to be loaded. To wait for the locale, this commit add a wait for WebsiteRoot.instance ensuring that locale and other WebsiteRoot widgets are ready. This may have been preferred to create a dummy child widget to WebsiteRoot, this way only WebsiteRoot would need to be ready and this would have been more extensible but this is a bigger change. note: this fix is for 11.0, for previous version the fix isef8cd11a6bopw-804555 closes #22241
This commit is contained in:
@@ -7,12 +7,12 @@ var core = require('web.core');
|
||||
var time = require('web.time');
|
||||
var Widget = require('web.Widget');
|
||||
var local_storage = require('web.local_storage');
|
||||
var websiteRootInstance = require('website.WebsiteRoot.instance');
|
||||
|
||||
var _t = core._t;
|
||||
var page_widgets = {};
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
(function () {
|
||||
var widget_parent = $('body');
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ $(document).ready(function () {
|
||||
// then return fix formate string else timeago
|
||||
display_str = "";
|
||||
if (datetime_obj && new Date().getTime() - datetime_obj.getTime() > 7 * 24 * 60 * 60 * 1000) {
|
||||
display_str = datetime_obj.toDateString();
|
||||
display_str = moment(datetime_obj).format('ll');
|
||||
} else {
|
||||
display_str = moment(datetime_obj).fromNow();
|
||||
}
|
||||
@@ -216,7 +216,7 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
return {
|
||||
page_widgets: page_widgets,
|
||||
|
||||
Reference in New Issue
Block a user