Entity attributes not working with date only string

I made a python script that push entities with there attributes via a MQTT integration. I have attributes that display a date and I’m having issue with the formatting.

  1. If I publish a date in the format YYYY-mm-dd (ex: 2023-08-30) it gets displayed in HA as August 29, 2023. Yes, a day earlier! It is not a typo.

  2. If I publish a date in the format YYYY-mm-ddTHH:MM:SSz (ex: 2023-08-30T00:00:00-0400) it gets displayed in HA as August 30, 2023 at 00:00:00. Which is good.

In some cases I want the full date and time, so option #2 is perfect, but in some other cases I only want the date to be displayed without the extra <at 00:00:00> and the correct date value.

Is there a way to publish a date only string and get it displayed in HA?

Thanks.

Almost positive what’s happening is the date is actually either

Being stored as a datetime and midnight is UTC - and your local time zone would be at that time if adjusted to UTC.

Being stored as a date only and what you’re using to display is assuming date @ midnight UTC and the time adjust bites you.

Can you store as a datetime (@midnight local time) instead?

I tried differente time zone from the configuration of HA frontend, and I’m still getting the 1 day offset with attributes published with a simple date format ‘YYYY-mm-dd’. I will try to publish them with a datetime or date object and see what happen.Thanks.