first commit

This commit is contained in:
Adrian Zürcher
2025-10-08 15:02:07 +02:00
commit 75ea1362a8
16 changed files with 1361 additions and 0 deletions

27
utils/utils.go Normal file
View File

@@ -0,0 +1,27 @@
package utils
import (
"net/mail"
"time"
)
func IsValidEmail(email string) bool {
_, err := mail.ParseAddress(email)
return err == nil
}
// Try multiple accepted date formats
var birthdayFormats = []string{
"2006-01-02", // ISO: 1999-12-12
"02.01.2006", // D.M.Y: 12.12.1999
"2.1.2006", // D.M.Y without leading zeros: 1.2.1999
}
func IsValidBirthday(birthday string) bool {
for _, layout := range birthdayFormats {
if _, err := time.Parse(layout, birthday); err == nil {
return true
}
}
return false
}