Skip to content

Commit

Permalink
Fix a JS crash when recurrence.language_code is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
jleclanche authored and aleksihakli committed Jan 21, 2022
1 parent 79a8af5 commit 7190d6c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions recurrence/static/recurrence/js/recurrence.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 7190d6c

Please sign in to comment.