From a3a525c02bf45fbe18d33605a471b422b6433964 Mon Sep 17 00:00:00 2001 From: nquidox Date: Tue, 10 Mar 2026 19:55:38 +0300 Subject: [PATCH] func added --- internal/merch/helper.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/merch/helper.go b/internal/merch/helper.go index 027feb1..95fdec2 100644 --- a/internal/merch/helper.go +++ b/internal/merch/helper.go @@ -3,6 +3,7 @@ package merch import ( "github.com/gin-gonic/gin" log "github.com/sirupsen/logrus" + "time" ) const ( @@ -23,3 +24,10 @@ func getUserId(c *gin.Context) int64 { id, _ := c.Get("userId") return id.(int64) } + +func getPeriod(days int) time.Time { + if days > 365 { + days = 7 + } + return time.Now().UTC().Add(-(time.Duration(days) * time.Hour * 24)) +}