Fix for dateutils change breaking royalroad

This commit is contained in:
Jim Miller 2021-09-04 15:11:49 -05:00
parent b94779f7d4
commit f7dcce698b

View file

@ -73,10 +73,10 @@ def parse_relative_date_string(reldatein):
logger.debug("val:%s unit_string:%s unit:%s"%(value, unit_string, unit))
## I'm not going to worry very much about accuracy for a site
## that considers '2 years ago' an acceptable time stamp.
if "year" in unit_string or 'year' in unit:
if "year" in unit_string or unit and ('year' in unit):
value = unicode(int(value)*365)
unit = 'days'
elif "month" in unit_string or 'month' in unit:
elif "month" in unit_string or unit and ('month' in unit):
value = unicode(int(value)*31)
unit = 'days'
logger.debug("val:%s unit_string:%s unit:%s"%(value, unit_string, unit))