fix(all): Fix in DATE filter.

This commit is contained in:
Rodrigo Rodriguez 2023-07-23 15:57:28 -03:00
parent 661a9c0350
commit ad47305a02

View file

@ -154,22 +154,22 @@ export class SystemKeywords {
if (date) { if (date) {
return array return array
? array.sort((a, b) => { ? array.sort((a, b) => {
const c = new Date(a[memberName]); const c = new Date(a[memberName]);
const d = new Date(b[memberName]); const d = new Date(b[memberName]);
return c.getTime() - d.getTime(); return c.getTime() - d.getTime();
}) })
: null; : null;
} else { } else {
return array return array
? array.sort((a, b) => { ? array.sort((a, b) => {
if (a[memberName] < b[memberName]) { if (a[memberName] < b[memberName]) {
return -1; return -1;
} }
if (a[memberName] > b[memberName]) { if (a[memberName] > b[memberName]) {
return 1; return 1;
} }
return 0; return 0;
}) })
: array; : array;
} }
} }
@ -662,7 +662,7 @@ export class SystemKeywords {
`${baseUrl}/drive/items/${document.id}/workbook/worksheets('${sheets.value[0].name}')/range(address='${addressId}')` `${baseUrl}/drive/items/${document.id}/workbook/worksheets('${sheets.value[0].name}')/range(address='${addressId}')`
) )
.patch(body); .patch(body);
body.values[0][0] = undefined ; body.values[0][0] = undefined;
// FINDs the filtered row to be updated. // FINDs the filtered row to be updated.
@ -1066,10 +1066,10 @@ export class SystemKeywords {
result = result.substr(1); result = result.substr(1);
} }
const resultDate = SystemKeywords.getDateFromLocaleString(pid, result, contentLocale); const resultDate = SystemKeywords.getDateFromLocaleString(pid, result, contentLocale);
if (filter.value['dateOnly']) {
resultDate.setHours(0, 0, 0, 0);
}
if (resultDate) { if (resultDate) {
if (filter.value['dateOnly']) {
resultDate.setHours(0, 0, 0, 0);
}
switch (filter.operator) { switch (filter.operator) {
case '=': case '=':
if (resultDate.getTime() == filter.value.getTime()) filterAcceptCount++; if (resultDate.getTime() == filter.value.getTime()) filterAcceptCount++;