2823fb45f5
Phone+OTP auth, staged onboarding, admin approval workflow, and a full discovery/swipe/match/chat system with photo upload and approximate distance (haversine) based on user location. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
17 lines
391 B
Go
17 lines
391 B
Go
package utils
|
|
|
|
import "time"
|
|
|
|
// CalcAge سن رو از تاریخ تولد حساب میکنه (نسبت به الان)
|
|
func CalcAge(birthDate *time.Time) int {
|
|
if birthDate == nil {
|
|
return 0
|
|
}
|
|
now := time.Now()
|
|
age := now.Year() - birthDate.Year()
|
|
if now.Month() < birthDate.Month() || (now.Month() == birthDate.Month() && now.Day() < birthDate.Day()) {
|
|
age--
|
|
}
|
|
return age
|
|
}
|