Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
'NaTType' object has no attribute 'days' - Error in custom factor

I am trying to create a custom function that subtracts two dates but have been getting this error when converting to days - 'NaTType' object has no attribute 'days'

class DateRange(CustomFactor):  
   inputs = [morningstar.share_class_reference.ipo_date]  
    window_length = 1  
    dtype = np.dtype('datetime64[ns]')  


    def compute(self, today, assets, out, date):  
        for ii, d in enumerate(date[0,:]):  
            date1 = pd.Timestamp(d, tz='UTC', offset='C')  
            delta = today - date1  
            out[ii] = delta.days  

is there a fix? Thanks!