Skip to content

Commit

Permalink
fix(basic.gblib): #170 Fixing DATEDIFF.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Mar 2, 2023
1 parent 8a89ae4 commit 4314a37
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/basic.gblib/services/DialogKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
1 change: 1 addition & 0 deletions packages/basic.gblib/services/GBVMService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export class GBVMService extends GBService {
sandbox['httpUsername'] = '';
sandbox['httpPs'] = '';
sandbox['pid'] = pid;
sandbox['contentLocale'] = contentLocale;

let result;

Expand Down
16 changes: 8 additions & 8 deletions packages/basic.gblib/services/KeywordsExpressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}})`;
}
];

Expand Down

0 comments on commit 4314a37

Please sign in to comment.