[Answered ]-Time Module – strptime Django Validation Error

2👍

From your function get_fiscal_year you are returning dict of time.struct_time objects while __range() needs date type object.

I would suggest to change your function to return date objects as

def get_fiscal_year(start_month=7):
now = datetime.datetime.now()
if now.month >= start_month:
    return [datetime.date(year=now.year, month=7, day=1), 
            datetime.date(year=now.year + 1, month=6, day=30)]
return [datetime.date(year=now.year-1, month=7, day=1), 
            datetime.date(year=now.year, month=6, day=30)]    
👤Rohan

Leave a comment