]> gitweb.mndrdr.org Git - arelpe.git/commitdiff
Fixed a date range bug where posts on 01-01 and 31-12 would disappear
authorAidan Cornelius-Bell <[email protected]>
Tue, 31 Dec 2024 20:22:24 +0000 (06:52 +1030)
committerAidan Cornelius-Bell <[email protected]>
Tue, 31 Dec 2024 20:22:24 +0000 (06:52 +1030)
app/controllers/pubview_controller.rb

index c97cbb6752fa836210ac152e07ae0af9b3f1b71f..610aa747a8b6c11a14af9d73c55da504c2811d2e 100644 (file)
@@ -32,8 +32,8 @@ class PubviewController < ApplicationController
   end
 
   def post
-    start_date = Date.new(params[:year].to_i, 1, 1)
-    end_date = Date.new(params[:year].to_i, 12, 31)
+    start_date = Date.new(params[:year].to_i, 1, 1).beginning_of_day
+    end_date = Date.new(params[:year].to_i, 12, 31).end_of_day
 
     @post = Post.find_by(slug: params[:slug], published_at: start_date..end_date)