diff options
Diffstat (limited to 'addons/web/static/src/js/core')
| -rw-r--r-- | addons/web/static/src/js/core/time.js | 24 |
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, }; }); |
