Skip to content

Commit

Permalink
Task advanced : the text for a negative number in "nth day of the mon…
Browse files Browse the repository at this point in the history
…th" is not right (#5482)

Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
  • Loading branch information
quinarygio committed Dec 14, 2023
1 parent 2b30514 commit ed1b7b4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,15 @@ export class TaskCardTemplateView {
if (bymonthday.includes("1")) textForBymonthday += opfab.utils.getTranslation("buildInTemplate.taskCard.firstDayOfTheMonth") + ", ";
if (bymonthday.includes("-1")) textForBymonthday += opfab.utils.getTranslation("buildInTemplate.taskCard.lastDayOfTheMonth") + ", ";
if (bymonthday.length > 0) {
if ((bymonthday[0] !== "1") && (bymonthday[0] !== "-1")) {
textForBymonthday += "The " + bymonthday[0] + this.cardinalToOrdinal(bymonthday[0]) + " " + opfab.utils.getTranslation("buildInTemplate.taskCard.dayOfTheMonth") + " , ";
this.replaceZero(bymonthday);
if (bymonthday[0] !== "1" && bymonthday[0] !== "-1") {
if (bymonthday[0].startsWith('-')) {
textForBymonthday += bymonthday[0].substring(1) + " " + opfab.utils.getTranslation("buildInTemplate.taskCard.daysBeforeEndOfTheMonth") + " , ";
} else {
textForBymonthday += opfab.utils.getTranslation("buildInTemplate.taskCard.the") + " " + bymonthday[0] + this.cardinalToOrdinal(bymonthday[0]) + " " + opfab.utils.getTranslation("buildInTemplate.taskCard.dayOfTheMonth") + " , ";
}
}

}
if (textForBymonthday !== "") {
textForBymonthday = textForBymonthday.slice(0, -2);
Expand Down Expand Up @@ -132,5 +138,8 @@ export class TaskCardTemplateView {
return ord;
}


replaceZero(days: any[]) {
const zeroIndex = days.findIndex(d => d === "0");
if (zeroIndex >= 0) days[zeroIndex] = "1";
}
}
1 change: 1 addition & 0 deletions ui/main/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@
"on": "on",
"firstDayOfTheMonth": "The first day of the month",
"lastDayOfTheMonth": "The last day of the month",
"daysBeforeEndOfTheMonth": "days before the end of the month",
"dayOfTheMonth": "day of the month",
"in": "in"
},
Expand Down
1 change: 1 addition & 0 deletions ui/main/src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@
"on": "le(s)",
"firstDayOfTheMonth": "Le premier jour du mois",
"lastDayOfTheMonth": "Le dernier jour du mois",
"daysBeforeEndOfTheMonth": "jours avant la fin du mois",
"dayOfTheMonth": "jour du mois",
"in": "en"
},
Expand Down
1 change: 1 addition & 0 deletions ui/main/src/assets/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@
"on": "op",
"firstDayOfTheMonth": "De eerste dag van de maand",
"lastDayOfTheMonth": "De laatste dag van de maand",
"daysBeforeEndOfTheMonth": "dagen voor het einde van de maand",
"dayOfTheMonth": "dag van de maand",
"in": "in"
},
Expand Down

0 comments on commit ed1b7b4

Please sign in to comment.