Move getDaysPassed to utils

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2022-08-01 13:06:35 +02:00
committed by Alexis Sellier
parent cc5c45cf43
commit 55057564fa
+1 -7
View File
@@ -1,6 +1,7 @@
import { Stats, Person, Project } from "@app/project";
import type { Diff } from "@app/diff";
import { ApiError } from "@app/api";
import { getDaysPassed } from "@app/utils";
export interface CommitsHistory {
headers: CommitMetadata[];
@@ -186,10 +187,3 @@ export function groupCommitsByWeek(commits: CommitMetadata[]): CommitGroup[] {
return groupedCommits;
}
// Get amount of days passed between two dates
function getDaysPassed(from: Date, to: Date): number {
return Math.floor(
(to.getTime() - from.getTime()) / (24 * 60 * 60 * 1000)
);
}