Logstash sql_last_value not compare correctly

I am using logstash to insert data from sql to index.
I am using a date column compare_date to compare for sql_last_value field.
When I am running, logstash automatically reduce 1 day from compare_date.
Suppose my compare_date is 2021-10-01, it automatically change it to 2021-09-30.
Here is my query:

select month,year, TO_DATE('01-'||LPAD(month,2,'0')||'-'||year,'dd-MM-YYYY') as compare_date
FROM my_table GROUP BY year,month ORDER BY year, month Asc
WHERE  compare_date > :sql_last_value  AND compare_date < NOW()

if month is 10 and year is 2021 than it change compare_date to 2021-09-30

I wonder if you are hitting this issue.