Skip to content

Commit

Permalink
Adjust L funtion to display alert message
Browse files Browse the repository at this point in the history
  • Loading branch information
wirachot committed Sep 6, 2024
1 parent 93614f1 commit 97d15f6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions dataFields/ABFieldDateCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ const ABField = require("../../platform/dataFields/ABField");

function L(key, altText) {
// TODO:
return altText; // AD.lang.label.getLabel(key) || altText;
// return altText; // AD.lang.label.getLabel(key) || altText;
return key.replace(/{(\d+)}/g, function (match, number) {
return typeof altText[number] !== "undefined" ? altText[number] : match;
});
}

const ABFieldDateDefaults = {
Expand Down Expand Up @@ -311,7 +314,9 @@ module.exports = class ABFieldDateCore extends ABField {
if (!isValid)
validator.addError(
this.columnName,
L("Should before {0}", [currentDate])
L("Should before {0}", [
this.getDateDisplay(currentDate),
])
);
break;
case "lessEqualCurrentDate":
Expand All @@ -321,7 +326,9 @@ module.exports = class ABFieldDateCore extends ABField {
if (!isValid)
validator.addError(
this.columnName,
L("Should before or equal {0}", [currentDate])
L("Should before or equal {0}", [
this.getDateDisplay(currentDate),
])
);
break;
}
Expand Down

0 comments on commit 97d15f6

Please sign in to comment.