lotus-ui-plus
Version:
Lotus UI Plus - Vue3 Component Library
24 lines (23 loc) • 859 B
JavaScript
function g(t, e = "YYYY-MM-DD") {
const r = t.getFullYear(), n = String(t.getMonth() + 1).padStart(2, "0"), o = String(t.getDate()).padStart(2, "0"), s = String(t.getHours()).padStart(2, "0"), i = String(t.getMinutes()).padStart(2, "0"), c = String(t.getSeconds()).padStart(2, "0");
return e.replace("YYYY", String(r)).replace("MM", n).replace("DD", o).replace("HH", s).replace("mm", i).replace("ss", c);
}
function a(t, e = 2) {
return t.toFixed(e);
}
function p(t) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t);
}
function u(t) {
return /^1[3-9]\d{9}$/.test(t);
}
function f(t) {
return t == null ? !0 : typeof t == "string" ? t.trim().length === 0 : Array.isArray(t) ? t.length === 0 : typeof t == "object" ? Object.keys(t).length === 0 : !1;
}
export {
g as formatDate,
a as formatNumber,
p as isEmail,
f as isEmpty,
u as isPhone
};