diff --git a/src/types/filter.type.ts b/src/types/filter.type.ts index 75a35c4..03c5eb4 100644 --- a/src/types/filter.type.ts +++ b/src/types/filter.type.ts @@ -2,6 +2,6 @@ export interface FilterWordsType { // range?: [number, number]; // Tuple Type. startRange?: number; endRange?: number; - timeFilter?: 'last_7d' | 'last_30d' | 'last_90d'; + timeFilter?: -7 | -30 | -90; familiarFilter?: 'all' | 'only_familiar' | 'only_unfamiliar'; } diff --git a/src/utils/date.util.ts b/src/utils/date.util.ts index 7938a42..d826cbf 100644 --- a/src/utils/date.util.ts +++ b/src/utils/date.util.ts @@ -1,3 +1,7 @@ export function getDateString(): number { return new Date().getTime(); } + +export function getXDaysAgoOrAfterTime(x: number): number { + return new Date(new Date().getTime() + x * 24 * 60 * 60 * 1000).getTime(); +}