refactor: move IBAN formatting into utils
This commit is contained in:
parent
63862ac627
commit
a6faab8ee9
2 changed files with 9 additions and 1 deletions
|
|
@ -267,7 +267,7 @@ frappe.ui.form.ControlData = class ControlData extends frappe.ui.form.ControlInp
|
|||
}
|
||||
format_for_input(val) {
|
||||
if (this.df.options == "IBAN" && val) {
|
||||
return val.replaceAll(" ", "").replace(/(.{4})(?=.)/g, "$1 ");
|
||||
return frappe.utils.get_formatted_iban(val);
|
||||
}
|
||||
return val == null ? "" : val;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1134,6 +1134,14 @@ Object.assign(frappe.utils, {
|
|||
return duration;
|
||||
},
|
||||
|
||||
get_formatted_iban(value) {
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replaceAll(" ", "").replace(/(.{4})(?=.)/g, "$1 ");
|
||||
},
|
||||
|
||||
seconds_to_duration(seconds, duration_options) {
|
||||
const round = seconds > 0 ? Math.floor : Math.ceil;
|
||||
const total_duration = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue