Last active
March 12, 2025 08:17
-
-
Save harunorimurata/af968c20a706c2a1e50d1108304b5eb0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // CalcAgeAt calculates the age at the given time. | |
| func CalcAgeAt(t time.Time, birthDay time.Time) int { | |
| age := t.Year() - birthDay.Year() | |
| if t.YearDay() < birthDay.YearDay() { | |
| age-- | |
| } | |
| return age | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment