Since, you are using third-party code, it's difficult to go through each and every line and identify what exact piece of code causing the issue.
Instead, you can take a look at official example code given by Microsoft in this official document.
One best practice is to update statistics on date columns each day as
new dates are added. Each time new rows are loaded into the dedicated
SQL pool, new load dates or transaction dates are added. These
additions change the data distribution and make the statistics out of
date.
The below two queries type can help you determine whether your statistics are stale.
Query 1: Find out the difference between the row count from the statistics (stats_row_count) and the actual row count (actual_row_count).
Query 2: Find out the age of your statistics by checking the last time your statistics were updated on each table.