title: In Rails, How Can Get Time.zone.now.in_time_zone.end_of_day to show today's date?
body: <p>I'm using <code>rails 6.1.4</code> and <code>ruby 2.6.7</code></p>
  <p>In my controller's index action I am using this:</p>
  <pre><code>weights_controller.rb
  
  def index
    # exercises entered today:
    @weights_today = Fitness::Weight.where(admin_user_id: session[:user_id])
                     .where(workout_date:  Time.zone.now.in_time_zone.beginning_of_day..Time.zone.now.in_time_zone.end_of_day)
                     .order(workout_date: :desc)
  ...
  end
  </code></pre>
  <p>On my weights index view, all the records I enter for a day seem to stop showing after around 6:00pm US Eastern time.  They show fine during the day, but not in the evening.</p>
  <p>I've tailed the log file in dev and on heroku (where my app lives), and the <code>Time.zone.now....end_of_day</code> is returning tomorrow's date.  i.e:</p>
  <pre><code>Fitness::Weight Load (0.8ms)  SELECT &quot;fitness_weights&quot;.* FROM &quot;fitness_weights&quot; WHERE &quot;fitness_weights&quot;.&quot;admin_user_id&quot; = $1 AND &quot;fitness_weights&quot;.&quot;workout_date&quot; BETWEEN $2 AND $3 ORDER BY &quot;fitness_weights&quot;.&quot;workout_date&quot; DESC  [[&quot;admin_user_id&quot;, 2], [&quot;workout_date&quot;, &quot;2021-11-21&quot;], [&quot;workout_date&quot;, &quot;2021-11-21&quot;]]
  </code></pre>
  <p>Today's date (this post) is &quot;2021-11-20&quot; not &quot;2021-11-21&quot;.  I've checked both the dev and live databases for records entered today and they all show today's date, not &quot;11-21&quot;.</p>
  <p>In my application controller I set the time zone to US Eastern:</p>
  <p><code>config.time_zone = 'Eastern Time (US &amp; Canada)'</code></p>
  <p>but this is not helping.</p>
  <p>How can I get this to show today's records at all times during the day?</p>
  <p>I've also tried <code>Time.current.today</code> and <code>Time.today</code> and even <code>Date.today</code>.  All seem to want to return tomorrow's date when run in the evening hours here where I am.</p>
  <p>Thanks for any tips.</p>
  <p><code>edited to add code for weights form and javascript</code></p>
  <pre><code>views/fitness/weights/_form.html.erb
  
  &lt;%= form_for(@weight) do |f| %&gt;
  ...
  
  &lt;div class=&quot;grid-x&quot;&gt;                                                                       
      &lt;div class=&quot;cell medium-2&quot;&gt;Date:&lt;/div&gt;                                                   
      &lt;div class=&quot;cell medium-2&quot;&gt;
        &lt;%= f.text_field :workout_date, { :size =&gt; 20, :type =&gt; 'date', :class =&gt; &quot;date-picker&quot;, :readonly =&gt; false, :value =&gt; @weight.id ? @weight.workout_date : Date.today } %&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
  ...
  
  &lt;% end %&gt;
  
  &lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;
  jQuery(document).ready(function() {
    jQuery('.date-picker').datepicker({
      inline: true,
    dateFormat: &quot;yy-mm-dd&quot;
    });
  });
  &lt;/script&gt;
  </code></pre>
  <p><code>edited to show insert from log on heroku</code></p>
  <pre><code>INSERT INTO &quot;fitness_weights&quot; (&quot;workout_date&quot;, &quot;muscle_group&quot;, &quot;exercise&quot;, &quot;weight_set_1&quot;, &quot;reps_set_1&quot;, &quot;weight_set_2&quot;, &quot;reps_set_2&quot;, &quot;weight_set_3&quot;, &quot;reps_set_3&quot;, &quot;weight_set_4&quot;, &quot;reps_set_4&quot;, &quot;weight_set_5&quot;, &quot;pr&quot;, &quot;comments&quot;, &quot;admin_user_id&quot;, &quot;created_at&quot;, &quot;updated_at&quot;) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17) RETURNING &quot;id&quot;  [[&quot;workout_date&quot;, &quot;2021-11-26&quot;], [&quot;muscle_group&quot;, &quot;BICEPTS&quot;], [&quot;exercise&quot;, &quot;SPIDER CURLS&quot;], [&quot;weight_set_1&quot;, &quot;15&quot;], [&quot;reps_set_1&quot;, 15], [&quot;weight_set_2&quot;, &quot;15&quot;], [&quot;reps_set_2&quot;, 15], [&quot;weight_set_3&quot;, &quot;15&quot;], [&quot;reps_set_3&quot;, 15], [&quot;weight_set_4&quot;, &quot;20&quot;], [&quot;reps_set_4&quot;, 8], [&quot;weight_set_5&quot;, &quot;&quot;], [&quot;pr&quot;, &quot;&quot;], [&quot;comments&quot;, &quot;&quot;], [&quot;admin_user_id&quot;, 1], [&quot;created_at&quot;, &quot;2021-11-26 14:17:22.244589&quot;], [&quot;updated_at&quot;, &quot;2021-11-26 14:17:22.244589&quot;]]
  </code></pre>