Automation does not work with input_helper but does hard coded

My automations that use input_datetime helpers don’t work correctly, but they do work if the times are hardcoded. Why do they behave differently?

Simple example.
Test 1 uses input_datetime.test_on = 20:15 and input_datetime.test_off = 21:30 entered via lovelace.
This automation never turns off the switch.

- id: '1111111'
  alias: Test 1
  description: Automation using timedate helpers
  trigger:
  - platform: time
    at: input_datetime.test_on
  - platform: time
    at: input_datetime.test_off
  - platform: homeassistant
    event: start
  condition: []
  action:
  - choose:
    - conditions:
      - condition: time
        after: input_datetime.test_on
        before: input_datetime.test_off
      sequence:
      - type: turn_on
        device_id: 90c6870ff45ef852a4dd0d28207a858c
        entity_id: switch.zbplug0
        domain: switch
    default:
    - type: turn_off
      device_id: 90c6870ff45ef852a4dd0d28207a858c
      entity_id: switch.zbplug0
      domain: switch
  mode: restart

Test 2 below is the same as Test 1 but without the helpers, the same times are hard coded instead. This works fine.

- id: '22222'
  alias: Test 2
  description: Automation using hardcoded times
  trigger:
  - platform: time
    at: '20:15'
  - platform: time
    at: '21:30'
  - platform: homeassistant
    event: start
  condition: []
  action:
  - choose:
    - conditions:
      - condition: time
        after: '20:15'
        before: '21:30'
      sequence:
      - type: turn_on
        device_id: 90c6870ff45ef852a4dd0d28207a858c
        entity_id: switch.zbplug0
        domain: switch
    default:
    - type: turn_off
      device_id: 90c6870ff45ef852a4dd0d28207a858c
      entity_id: switch.zbplug0
      domain: switch
  mode: restart

I can’t allow users to edit automation code, so I need to understand what’s wrong with the input_datetime approach.

There is another issue which I reckon is related and might be affecting the triggers. Using the automation UI the input_datetime helpers don’t render on screen but the YAML does get written correctly. The helpers just don’t appear in the UI and the automation runs as if the instruction list were what you see on screen and not per the YAML. I’m tearing my hair out.

I’m pretty sure all the above is due to a bug. I wouldn’t know how to report it though.