fix(basic.gblib): #170 Fixing DATEDIFF.

This commit is contained in:
rodrigorodriguez 2023-03-02 14:24:51 -03:00
parent 8a89ae4e44
commit 4314a37916
3 changed files with 10 additions and 9 deletions

View file

@ -345,7 +345,7 @@ export class DialogKeywords {
* @example days = DATEDIFF date1,date2,mode
*
*/
public dateDiff(date1, date2, mode) {
public getDateDiff(date1, date2, mode) {
let dt1 = date1;
let dt2 = date2;
if (!(dt1 instanceof Date)) {

View file

@ -386,6 +386,7 @@ export class GBVMService extends GBService {
sandbox['httpUsername'] = '';
sandbox['httpPs'] = '';
sandbox['pid'] = pid;
sandbox['contentLocale'] = contentLocale;
let result;

View file

@ -456,18 +456,18 @@ export class KeywordsExpressions {
];
keywords[i++] = [
/^\s*(datediff)(\s*)(.*)/gim,
($0, $1, $2, $3) => {
const params = this.getParams($3, ['date1', 'date2', 'mode']);
return `await dk.dateDiff (pid: pid, ${params}})`;
/^\s*(.*)\=\s*(datediff)(\s*)(.*)/gim,
($0, $1, $2, $3, $4) => {
const params = this.getParams($4, ['date1', 'date2', 'mode']);
return `await dk.getDateDiff ({pid: pid, ${params}})`;
}
];
keywords[i++] = [
/^\s*(dateadd)(\s*)(.*)/gim,
($0, $1, $2, $3) => {
const params = this.getParams($3, ['date', 'mode', 'units']);
return `await dk.dateAdd (pid: pid, ${$3})`;
/^\s*(.*)\=\s*(dateadd)(\s*)(.*)/gim,
($0, $1, $2, $3, $4) => {
const params = this.getParams($4, ['date', 'mode', 'units']);
return `await dk.dateAdd ({pid: pid, ${params}})`;
}
];