I'm developing a tournament bracketing app and need to compare some dates together in order to place them in their designated age group. I can't seem to figure out how I would write something like this.
6 - under = 2007-09-01 to present
8 - under = 2005-09-01 to 2007-08-31
10 - under = 2003-09-01 to 20050831
Would it be something like this? and is there a better way to compare the dates to each other.
def age_group
if self.dob <= 20030901
"10"
elsif self.dob <= 20050901
"8"
else self.dob <= 20070901
"6"
end
end
Thank you