This commit is contained in:
2023-04-15 20:10:09 +00:00
parent 6ed59628e0
commit 4f57c829ee
2 changed files with 123 additions and 62 deletions

View File

@@ -537,6 +537,33 @@ export default {
return new Date(value) < new Date();
},
///////////////////////////////////////////////
// parse UTC ISO 8601 strings, compare
// if(d1 is less than d2 )
d1IsBeforeD2FromUTC8601String(d1, d2) {
if (!d1 || d1 == "" || !d2 == null || d2 == "") {
throw new Error("isD1BeforeD2 empty value");
}
//instantiate a luxon date object from val which is assumed to be an iso string
const d1Date = window.$gz.DateTime.fromISO(d1);
if (!d1Date.isValid) {
throw new Error("locale::isD1BeforeD2, d1 not valid:", {
d1: d1,
d1Date: d1Date
});
}
const d2Date = window.$gz.DateTime.fromISO(d2);
if (!d2Date.isValid) {
throw new Error("locale::isD1BeforeD2, d2 not valid:", {
d2: d2,
d2Date: d2Date
});
}
return d1Date < d2Date;
},
///////////////////////////////////////////
// Turn a decimal number into a local
// currency display