Rails 5 Ruby 2.5.3 If statements based on ranges of months

Rails 5 Ruby 2.5.3 If statements based on ranges of months

so I'm working on a personal project.

so I'm working on a personal project.

I'm a truck driver and i am building a simple app to track and calculate revenue ect..

What I am trying to do (and there may be a much better way to do it) is highlight what my current active fuel surcharge is based only on a range of months.

In this case its April 1 to Oct 31 and Nov 1 to March 31 this can change as contract requirements dictate ect.

I have an activeDate and endDate column in my database and this is what I have come up with (but doesn't seem to work).

**<<index.html.erb>>**

  &lt;tbody&gt;
    &lt;% @fscs.each do |fsc| %&gt;
      &lt;% if Date.today === (fsc.activeDate..fsc.endDate) %&gt;
        &lt;tr&gt;
          &lt;td class="fsc_active"&gt;&lt;%= fsc.name %&gt;&lt;/td&gt;
          &lt;td class="fsc_active"&gt;&lt;%= fsc.rate %&gt;&lt;/td&gt;
          &lt;td class="fsc_active"&gt;&lt;%= fsc.activeDate %&gt;&lt;/td&gt;
          &lt;td class="fsc_active"&gt;&lt;%= fsc.endDate %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= link_to 'View', fsc %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= link_to 'Edit', edit_fsc_path(fsc) %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= link_to 'Delete', fsc, method: :delete, data: { confirm: 'Are you sure?' } %&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;% else %&gt;
        &lt;tr&gt;
          &lt;td class="fsc_inactive"&gt;&lt;%= fsc.name %&gt;&lt;/td&gt;
          &lt;td class="fsc_inactive"&gt;&lt;%= fsc.rate %&gt;&lt;/td&gt;
          &lt;td class="fsc_inactive"&gt;&lt;%= fsc.activeDate %&gt;&lt;/td&gt;
          &lt;td class="fsc_inactive"&gt;&lt;%= fsc.endDate %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= link_to 'View', fsc %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= link_to 'Edit', edit_fsc_path(fsc) %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= link_to 'Delete', fsc, method: :delete, data: { confirm: 'Are you sure?' } %&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;% end %&gt;
    &lt;% end %&gt;
  &lt;/tbody&gt;

Any advice on where I'm going wrong or pointers on how to make this better would be greatly appreciated! please let me know if more information is needed.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Ruby on Rails vs PHP

Understanding the pros and cons of Ruby on Rails versus PHP is important when deciding how to create your business-critical applications.