summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-12-06 12:02:58 +0100
committerChristophe Simonis <chs@odoo.com>2017-12-06 12:02:58 +0100
commit8ef7af6afe54fbd59051bbbce76daadd6fdb0e86 (patch)
treeb21971e972eacc87e198fbc38b48ac9b70d168fc /addons/web/static/src/js/core
parent010add290342ae1e2887450a381e0d1f0acd34e5 (diff)
parentf96a797fe6238306ec70d3db013b8a4d348ef181 (diff)
[MERGE] forward port branch 11.0 up to f96a797fe62
Diffstat (limited to 'addons/web/static/src/js/core')
-rw-r--r--addons/web/static/src/js/core/time.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/web/static/src/js/core/time.js b/addons/web/static/src/js/core/time.js
index 3ed4165abaa..8bce87e3109 100644
--- a/addons/web/static/src/js/core/time.js
+++ b/addons/web/static/src/js/core/time.js
@@ -279,6 +279,27 @@ var normalize_format_table = {
};
var inverse_normalize_format_table = _.invert(normalize_format_table);
+/**
+ * Get date format of the user's language
+ */
+function getLangDateFormat() {
+ return this.strftime_to_moment_format(_t.database.parameters.date_format);
+}
+
+/**
+ * Get time format of the user's language
+ */
+function getLangTimeFormat() {
+ return this.strftime_to_moment_format(_t.database.parameters.time_format);
+}
+
+/**
+ * Get date time format of the user's language
+ */
+function getLangDatetimeFormat() {
+ return this.strftime_to_moment_format(_t.database.parameters.date_format + " " + _t.database.parameters.time_format);
+}
+
return {
@@ -293,6 +314,9 @@ return {
auto_date_to_str: auto_date_to_str,
strftime_to_moment_format: strftime_to_moment_format,
moment_to_strftime_format: moment_to_strftime_format,
+ getLangDateFormat: getLangDateFormat,
+ getLangTimeFormat: getLangTimeFormat,
+ getLangDatetimeFormat: getLangDatetimeFormat,
};
});