On my join script you have to be 13+ to join. The problem is when I check it against certain dates it only works if I do it a month back.
cur_time = datetime.datetime.utcnow() - datetime.timedelta(days=4848.12)
time_13 = str(cur_time.strftime("%Y-%m-%d"))
bmonth = self.get_argument('bmonth', '')
bday = self.get_argument('bday', '')
byear = self.get_argument('byear', '')
birthday = byear + '-' + bmonth + '-' + bday
if time_13 <= birthday:
c_age = True
else:
c_age = ''
if c_age:
response = tornado.escape.json_encode({"error":"true","msg":"You must be 13 years of age or older to join uSocial'N"})
It’s better to compare dates and date ranges rather than strings.
Assuming you get strings for birthday parts: