-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
slightly optimize contribution stats using sets
- Loading branch information
Showing
4 changed files
with
27 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
export const WEEK_LENGTH = 604800000; | ||
export function lastWeek() { | ||
return new Date(+new Date() - WEEK_LENGTH); | ||
return new Date(new Date().getTime() - WEEK_LENGTH); | ||
} | ||
|
||
export const MONTH_LENGTH = 2629800000; | ||
export function lastMonth() { | ||
return new Date(+new Date() - MONTH_LENGTH); | ||
return new Date(new Date().getTime() - MONTH_LENGTH); | ||
} | ||
|
||
export const DAY_LENGTH = 86400000; | ||
export function lastDay() { | ||
return new Date(new Date().getTime() - DAY_LENGTH); | ||
} | ||
|
||
export function startOfDay(date: Date | number) { | ||
const result = new Date(date); | ||
result.setHours(0, 0, 0, 0); | ||
return result; | ||
} | ||
|
||
export const DAY_LENGTH = 86400000; | ||
export function lastDay() { | ||
return new Date(+new Date() - DAY_LENGTH); | ||
} |