Skip to content

Commit

Permalink
update timeframe after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
PopDaph committed Sep 6, 2023
1 parent 3dc2bf8 commit 775c7ff
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions front/lib/api/assistant/actions/retrieval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ export function parseTimeFrame(raw: string): TimeFrame | null {
export function timeFrameFromNow(timeFrame: TimeFrame): number {
const now = Date.now();

switch (timeFrame.duration) {
switch (timeFrame.unit) {
case "hour":
return now - timeFrame.count * 60 * 60 * 1000;
return now - timeFrame.duration * 60 * 60 * 1000;
case "day":
return now - timeFrame.count * 24 * 60 * 60 * 1000;
return now - timeFrame.duration * 24 * 60 * 60 * 1000;
case "week":
return now - timeFrame.count * 7 * 24 * 60 * 60 * 1000;
return now - timeFrame.duration * 7 * 24 * 60 * 60 * 1000;
case "month":
return now - timeFrame.count * 30 * 24 * 60 * 60 * 1000;
return now - timeFrame.duration * 30 * 24 * 60 * 60 * 1000;
case "year":
return now - timeFrame.count * 365 * 24 * 60 * 60 * 1000;
return now - timeFrame.duration * 365 * 24 * 60 * 60 * 1000;
}
}

Expand Down

0 comments on commit 775c7ff

Please sign in to comment.