Skip to content

Commit 1166766

Browse files
committed
chore: calculate for last 24 hours
1 parent 08f549a commit 1166766

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A Command-line tool to statistics the GitHub repositories
66
## Install
77

88
```bash
9-
$ go install github.com/anqiansong/github-compare
9+
$ go install github.com/anqiansong/github-compare@latest
1010
```
1111

1212
## Example

pkg/stat/star.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ type (
5454
)
5555

5656
func (s StargazerEdges) LatestDayStars() (int, int) {
57-
y, m, d := time.Now().Date()
58-
deadlineOfToday := time.Date(y, m, d, 0, 0, 0, 0, time.Local)
59-
deadlineOfYesterday := deadlineOfToday.AddDate(0, 0, -1)
57+
deadlineOfToday := time.Now().Add(-time.Hour * 24)
58+
deadlineOfYesterday := deadlineOfToday.Add(-time.Hour * 24)
6059
var starsOfToday, starsOfYesterday int
6160
for _, e := range s {
6261
if e.StarredAt.Time.After(deadlineOfToday) {

0 commit comments

Comments
 (0)