From f09717bf9a1795b224da4e3cae7e6af7b13b5fe1 Mon Sep 17 00:00:00 2001 From: Aidan Cornelius-Bell Date: Wed, 1 Jan 2025 06:52:24 +1030 Subject: [PATCH] Fixed a date range bug where posts on 01-01 and 31-12 would disappear --- app/controllers/pubview_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/pubview_controller.rb b/app/controllers/pubview_controller.rb index c97cbb6..610aa74 100644 --- a/app/controllers/pubview_controller.rb +++ b/app/controllers/pubview_controller.rb @@ -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) -- 2.39.5