I am wanting to calculate the time that a registered client has, if the client has less than 3 months since his registration date, the client is still active, if the client has more than 3 months and less than 12 months, he is semi-active, do I explain? I have tried some ideas however they are not foolproof, for example:
<% if time_ago_in_words(customer.date_of_issue) == "3 meses" %>
<span class="badge badge-pill badge-success">Activo</span>
<% elsif customer.date_of_issue == "3 meses" && time_ago_in_words(customer.date_of_issue) < "6 meses" %>
<span class="badge badge-pill badge-warning">Semi Activo</span>
<% else time_ago_in_words(customer.date_of_issue) > "6 meses" %>
<span class="badge badge-pill badge-danger">Inactivo</span>
<% end %>
However, it is not precise since months or days cannot be compared, since it is a text string, so it only reads the numbers of the string, I know that there is a more correct way to do this, something similar to:
<% if customer.date_of_issue == Date.new..3.months.ago %>Active<% else %>Older<%end %>
However I can't get it to work correctly, I appreciate all your help