Template sensor comparing a datetime to today

I have been playing with the developer tool for template sensor building and have the below code working but it is UGLY. I am sure there is a better way to do it. But when I try to create a sensor with this info, it fails because it doesn’t like my custom_time function format for some reason.

{{ states("sensor.grocy_chores") }}
    {% set chores = state_attr('sensor.grocy_chores', 'chores') | selectattr('next_execution_assigned_to_user_id','eq',2) | list %}
  {% set endofday = as_timestamp(now().date() | timestamp_custom('%Y.%m.%d 23:59'))  %}

  {%
  set data = namespace(pastchores=[])
  %}
  {%- for chore in chores -%}
      {% set choredue =  as_timestamp(chore.next_estimated_execution_time) | int  %}
      {% if choredue < endofday %}
        {% set data.pastchores = data.pastchores + [chore.name] %}
      {% endif %}
  
  {%- endfor -%}

{{ data.pastchores | list }}

So basically what I am doing here is looking for all chores assigned to id = 2. Then looping through them and seeing if they are overdue or due today. I do the today based on the date and manually adding the 11:59pm. I feel there has to be a better way to do this. I am just looking to get a list of the chores overdue or due today in a dedicated list.

Any suggestions? (still new to the templating stuff)

thanks!!