summaryrefslogtreecommitdiff
path: root/pkg/web/cookie/option.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-30 17:01:41 -0600
committermo khan <mo@mokhan.ca>2025-04-30 17:01:43 -0600
commita372feb94ba1dfe119f2b350b77302a243ab17f2 (patch)
treeb371003072df944feb2d6fe3a60c785e7bfb4f22 /pkg/web/cookie/option.go
parent85de7a7ecc5260029cadf16af10acae2def9f528 (diff)
fix: adjust cookie expiration calculation
Diffstat (limited to 'pkg/web/cookie/option.go')
-rw-r--r--pkg/web/cookie/option.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/web/cookie/option.go b/pkg/web/cookie/option.go
index 3f2cc93..58a2e93 100644
--- a/pkg/web/cookie/option.go
+++ b/pkg/web/cookie/option.go
@@ -50,7 +50,8 @@ func WithExpiration(expires time.Time) x.Option[*http.Cookie] {
if expires.Before(time.Now()) {
c.MaxAge = -1
} else {
- c.MaxAge = int(time.Until(expires).Seconds())
+ duration := time.Until(expires).Round(time.Second)
+ c.MaxAge = int(duration.Seconds())
}
})
}