added: time util

This commit is contained in:
nquidox 2025-12-06 17:32:45 +03:00
parent aeb5cb819b
commit a338fd03b2
2 changed files with 16 additions and 1 deletions

View file

@ -1,6 +1,9 @@
package interfaces
import "github.com/gin-gonic/gin"
import (
"github.com/gin-gonic/gin"
"time"
)
type Utils interface {
IsEmail(email string) bool
@ -8,4 +11,5 @@ type Utils interface {
GetRefreshUuidFromContext(c *gin.Context) (string, error)
HashPassword(password string) (string, error)
ComparePasswords(hashedPassword string, plainPassword string) error
ParseTime(t string) (time.Time, error)
}

11
pkg/utils/time.go Normal file
View file

@ -0,0 +1,11 @@
package utils
import "time"
func (u *Utils) ParseTime(t string) (time.Time, error) {
timeStr, err := time.Parse(time.RFC3339, t)
if err != nil {
return time.Time{}, err
}
return timeStr, nil
}