mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Fix date filter for DateTime columns.
Summary: Date filter was not taking timezone correclty into account, which was causing to wrong-inclusion and wrong-exclusion of dates near the bounds. Diff fixes that, it also bring little refactoring that hopefully clarifies things a little. Test Plan: Includes brand new test for `app/common/ColumnFilterFunc`. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D3763
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import {
|
||||
CURRENT_DATE, diffUnit, formatRelBounds, IPeriod, IRelativeDateSpec, isEquivalentRelativeDate, toUnixTimestamp
|
||||
CURRENT_DATE,
|
||||
diffUnit,
|
||||
formatRelBounds,
|
||||
IPeriod,
|
||||
IRelativeDateSpec,
|
||||
isEquivalentRelativeDate,
|
||||
relativeDateToUnixTimestamp
|
||||
} from "app/common/RelativeDates";
|
||||
import { IRangeBoundType, isRelativeBound } from "app/common/FilterState";
|
||||
import getCurrentTime from "app/common/getCurrentTime";
|
||||
@@ -55,7 +61,7 @@ function relativeDateOptionsSpec(value: IRangeBoundType): Array<IRangeBoundType>
|
||||
if (value === undefined) {
|
||||
return DEFAULT_OPTION_LIST;
|
||||
} else if (isRelativeBound(value)) {
|
||||
value = toUnixTimestamp(value);
|
||||
value = relativeDateToUnixTimestamp(value);
|
||||
}
|
||||
|
||||
const date = moment.utc(value * 1000);
|
||||
|
||||
Reference in New Issue
Block a user