fix(basic.gblib): NOW keyword is now formatting values with two zeros.

This commit is contained in:
Rodrigo Rodriguez 2021-08-15 12:00:36 -03:00
parent b99c917754
commit 296b999ec3

View file

@ -464,6 +464,7 @@ export class SystemKeywords {
case 'date':
const resultDate = SystemKeywords.getDateFromLocaleString(result, contentLocale);
if (resultDate) {
switch (filter.operator) {
case '=':
if (resultDate.getTime() == filter.value.getTime())
@ -487,6 +488,9 @@ export class SystemKeywords {
break;
}
break;
} else {
GBLog.info(`BASIC: FIND with NULL date in filter.`);
}
}
});
@ -517,6 +521,7 @@ export class SystemKeywords {
private static getDateFromLocaleString(date: any, contentLocale: any) {
const parts = /^([0-3]?[0-9]).([0-3]?[0-9]).((?:[0-9]{2})?[0-9]{2})$/gi.exec(date);
if (parts[3]) {
switch (contentLocale) {
case 'pt':
date = new Date(Number.parseInt(parts[2]), Number.parseInt(parts[1]), Number.parseInt(parts[3]), 0, 0, 0, 0);
@ -527,6 +532,10 @@ export class SystemKeywords {
}
return date;
}
else {
return null;
}
}
/**
* Creates a folder in the bot instance drive.