Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(tablefilter): fix table filter fromjson condition error (#5584)

VicKun6595c020e590
diff --git a/packages/sheets-table/src/model/filter-util/date-filter-util.ts b/packages/sheets-table/src/model/filter-util/date-filter-util.ts
index e05d1055ea..8fa9b78bac 100644
--- a/packages/sheets-table/src/model/filter-util/date-filter-util.ts
+++ b/packages/sheets-table/src/model/filter-util/date-filter-util.ts
@@ -421,32 +421,32 @@ export function getDateFilterExecuteFunc(filterInfo: ITableDateFilterInfo) {
switch (filterInfo.compareType) {
case TableDateCompareTypeEnum.Equal:
{
- const expected = filterInfo.expectedValue as Date;
+ const expected = new Date(filterInfo.expectedValue as string | Date);
return (date: Date) => date.getTime() === expected.getTime();
}
case TableDateCompareTypeEnum.NotEqual:
{
- const expected = filterInfo.expectedValue as Date;
+ const expected = new Date(filterInfo.expectedValue as string | Date);
return (date: Date) => date.getTime() !== expected.getTime();
}
case TableDateCompareTypeEnum.After:
{
- const expected = filterInfo.expectedValue as Date;
+ const expected = new Date(filterInfo.expectedValue as string | Date);
return (date: Date) => date.getTime() > expected.getTime();
}
case TableDateCompareTypeEnum.Before:
{
- const expected = filterInfo.expectedValue as Date;
+ const expected = new Date(filterInfo.expectedValue as string | Date);
return (date: Date) => date.getTime() < expected.getTime();
}
case TableDateCompareTypeEnum.AfterOrEqual:
{
- const expected = filterInfo.expectedValue as Date;
+ const expected = new Date(filterInfo.expectedValue as string | Date);
return (date: Date) => date.getTime() >= expected.getTime();
}
case TableDateCompareTypeEnum.BeforeOrEqual:
{
- const expected = filterInfo.expectedValue as Date;
+ const expected = new Date(filterInfo.expectedValue as string | Date);
return (date: Date) => date.getTime() <= expected.getTime();
}
case TableDateCompareTypeEnum.Between: