File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2186,14 +2186,18 @@ func (d DAURequest) asRequestOption() RequestOption {
2186
2186
}
2187
2187
}
2188
2188
2189
+ // TimezoneOffsetHour is implemented to match the javascript 'getTimezoneOffset()' function.
2190
+ // This is the amount of time between this date evaluated in UTC and evaluated in the 'loc'
2191
+ // The trivial case of times being on the same day is:
2192
+ // 'time.Now().UTC().Hour() - time.Now().In(loc).Hour()'
2189
2193
func TimezoneOffsetHour (loc * time.Location ) int {
2190
2194
if loc == nil {
2191
2195
// Default to UTC time to be consistent across all callers.
2192
2196
loc = time .UTC
2193
2197
}
2194
2198
_ , offsetSec := time .Now ().In (loc ).Zone ()
2195
- // Convert to hours
2196
- return offsetSec / 60 / 60
2199
+ // Convert to hours and flip the sign
2200
+ return - 1 * offsetSec / 60 / 60
2197
2201
}
2198
2202
2199
2203
func (c * Client ) DeploymentDAUsLocalTZ (ctx context.Context ) (* DAUsResponse , error ) {
You can’t perform that action at this time.
0 commit comments