use Utils.escapeHtml instead of manual escaping

This commit is contained in:
MikeCAT 2023-03-18 00:54:43 +09:00
parent d9d6b7aa37
commit ab283fc801

View file

@ -5,6 +5,7 @@
*/
import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs";
import moment from "moment-timezone";
import {DATETIME_FORMATS, FORMAT_EXAMPLES} from "../lib/DateTime.mjs";
@ -85,9 +86,7 @@ class TranslateDateTimeFormat extends Operation {
if (data === this.invalidFormatMessage) {
return `${data}\n\n${FORMAT_EXAMPLES}`;
}
return data.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
return Utils.escapeHtml(data);
}
}