mirror of
https://github.com/idanoo/go-mastodon-stats
synced 2025-07-01 22:02:20 +00:00
Only report to mastodon Mondays
This commit is contained in:
parent
003efe910e
commit
533cde2eaf
4 changed files with 74 additions and 29 deletions
|
@ -14,3 +14,17 @@ func getStartofDay() time.Time {
|
|||
year, month, day := t.Date()
|
||||
return time.Date(year, month, day, 0, 0, 0, 0, t.Location())
|
||||
}
|
||||
|
||||
func getStartofDayMonday() time.Time {
|
||||
localTime, err := time.LoadLocation(TIMEZONE)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// Iterate until Monday!
|
||||
t := time.Now().In(localTime)
|
||||
for t.Weekday() != time.Monday {
|
||||
t = t.AddDate(0, 0, -1)
|
||||
}
|
||||
year, month, day := t.Date()
|
||||
return time.Date(year, month, day, 0, 0, 0, 0, t.Location())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue