Skip to content

Instantly share code, notes, and snippets.

@pezra
Created March 31, 2009 17:53
Show Gist options
  • Save pezra/88302 to your computer and use it in GitHub Desktop.
Save pezra/88302 to your computer and use it in GitHub Desktop.
def expired?
# is the record's file_date over the specified number of days until expiration
if !self.identity_address.nil? && !self.identity_address.last_date_reported.blank?
last_date_reported = self.identity_address.last_date_reported.to_s
formatted_date = [ last_date_reported.slice(0,4), last_date_reported.slice(4,2), last_date_reported.slice(6,2) ].join("-")
begin
return true unless verified_date = Date.parse(formatted_date)
rescue Exception => e
raise "\"#{last_date_reported}\" is not a valid date"
end
( Date.today - verified_date ).to_i > DAYS_TO_ID_EXPIRATION
else
return true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment