Skip to content

Commit 15f3dbb

Browse files
committed
update past year filter constant
1 parent 61b6d61 commit 15f3dbb

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

packages/core/constants/index.ts

+5-12
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,16 @@ const DATE_LAST_MONTH = new Date(BEGINNING_OF_TODAY);
3838
DATE_LAST_MONTH.setMonth(BEGINNING_OF_TODAY.getMonth() - 1);
3939
const DATE_LAST_WEEK = new Date(BEGINNING_OF_TODAY);
4040
DATE_LAST_WEEK.setDate(BEGINNING_OF_TODAY.getDate() - 7);
41+
export const PAST_YEAR_FILTER = new FileFilter(
42+
AnnotationName.UPLOADED,
43+
`RANGE(${DATE_LAST_YEAR.toISOString()},${END_OF_TODAY.toISOString()})`
44+
);
4145
export const RELATIVE_DATE_RANGES = [
4246
{
4347
name: "Uploaded in last year",
4448
description:
4549
"This will automatically filter files down to those uploaded within the last year",
46-
filters: [
47-
new FileFilter(
48-
AnnotationName.UPLOADED,
49-
`RANGE(${DATE_LAST_YEAR.toISOString()},${END_OF_TODAY.toISOString()})`
50-
),
51-
],
50+
filters: [PAST_YEAR_FILTER],
5251
hierarchy: undefined,
5352
sort: undefined,
5453
},
@@ -106,12 +105,6 @@ export const RELATIVE_DATE_RANGES = [
106105
sort: undefined,
107106
},
108107
];
109-
export const INITIAL_DATE_FILTER = [
110-
new FileFilter(
111-
AnnotationName.UPLOADED,
112-
`RANGE(${DATE_LAST_YEAR.toISOString()},${END_OF_TODAY.toISOString()})`
113-
),
114-
];
115108

116109
export const TOP_LEVEL_FILE_ANNOTATIONS = [
117110
new Annotation({

packages/core/state/selection/reducer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { makeReducer } from "@aics/redux-utils";
22
import { castArray, difference, omit, without } from "lodash";
33

44
import interaction from "../interaction";
5-
import { AnnotationName, INITIAL_DATE_FILTER } from "../../constants";
5+
import { AnnotationName, PAST_YEAR_FILTER } from "../../constants";
66
import Annotation from "../../entity/Annotation";
77
import FileFilter from "../../entity/FileFilter";
88
import FileFolder from "../../entity/FileFolder";
@@ -58,7 +58,7 @@ export const initialState = {
5858
},
5959
displayAnnotations: [],
6060
fileSelection: new FileSelection(),
61-
filters: [...INITIAL_DATE_FILTER],
61+
filters: [PAST_YEAR_FILTER],
6262
openFileFolders: [],
6363
shouldDisplaySmallFont: false,
6464
sortColumn: new FileSort(AnnotationName.UPLOADED, SortOrder.DESC),

0 commit comments

Comments
 (0)