From 7190d6ca1f20fb248d516f1b405d0d9ff4b84e18 Mon Sep 17 00:00:00 2001 From: Jerome Leclanche Date: Wed, 10 Jun 2020 08:56:35 +0200 Subject: [PATCH] Fix a JS crash when recurrence.language_code is not defined --- recurrence/static/recurrence/js/recurrence.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recurrence/static/recurrence/js/recurrence.js b/recurrence/static/recurrence/js/recurrence.js index 9db6a1e..6789890 100644 --- a/recurrence/static/recurrence/js/recurrence.js +++ b/recurrence/static/recurrence/js/recurrence.js @@ -445,13 +445,13 @@ recurrence.DateFormat.prototype = { S: function() { var day = this.data.getDate(); var ordinal_indicator = recurrence.display.ordinal_indicator; - var language_code = recurrence.language_code; + var language_code = recurrence.language_code || "en-us"; if (language_code in ordinal_indicator) { return ordinal_indicator[language_code](day); - } else if (language_code.split('-')[0] in ordinal_indicator) { - return ordinal_indicator[language_code.split('-')[0]](day) - } - return ''; + } else if (language_code.split("-")[0] in ordinal_indicator) { + return ordinal_indicator[language_code.split("-")[0]](day); + } + return ""; }, t: function() {