Fundamentally dates and time time in computer speak are represented by an integer which represents the seconds since 1.1.1970. So it is pretty easy to compare - just use if/then statements.
Ok, the background:
I have fix dates when i have to clean the stairs in the house.
I insert the dates into the calendar in HA and made template_sensors to convert them
Because you are using fixed dates you can check if the current date is in range by formatting all the dates fields in “YYMMDD” format and then check it in the display lambda. To make it as easy as possible you can add two extra sensors in HA with start & end date in YYMMDD format and ‘download’ them to the esp as well just for the IF statement, so you don’t have to manipulate the date sensors you are displaying on the screen.
if (id(test_start_YYMMDD).state <= id(today_date_YYMMDD).state && id(today_date_YYMMDD).state <= id(test_ende_YYMMDD).state) {
// within range
} else {
// outside range
}
I would be tempted to create a similar template binary sensor on the HA side for this since they are already doing some templating there, and then import that binary sensor into and use that to drive things.
Typically I like to do things on the esp but if you do it on the HA side then it’s easier to access it for other alerts etc.