mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-13 17:40:26 -07:00
fix: respect client timezone for requests (#119)
* maybe fixed for total listen activity * maybe actually fixed now * fix unset location panics
This commit is contained in:
parent
2925425750
commit
f48dd6c039
13 changed files with 368 additions and 343 deletions
|
|
@ -13,11 +13,15 @@ type Timeframe struct {
|
|||
ToUnix int64
|
||||
From time.Time
|
||||
To time.Time
|
||||
Timezone *time.Location
|
||||
}
|
||||
|
||||
func TimeframeToTimeRange(tf Timeframe) (t1, t2 time.Time) {
|
||||
now := time.Now()
|
||||
loc := now.Location()
|
||||
loc := tf.Timezone
|
||||
if loc == nil {
|
||||
loc, _ = time.LoadLocation("UTC")
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// 1. Explicit From / To (time.Time) — highest precedence
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue