I'm trying to use something like the below, but sorting the rows based on state (which is the number of days until the persons birthday, but it's a string value not an int).
How do I cast the state in the sort so the rows are ordered correctly?
e.g. I'm currently getting rows in the order of '108', '112', '18', '1', '208', '20' which is not what anyone would expect.
{%- for state in states.birthdays|sort(attribute="state") -%}
{{{ "state": state.state,"name": state_attr(state.entity_id, "friendly_name"), "secondary": "Will be " ~ state_attr(state.entity_id, "age_at_next_birthday") ~ ", born " ~ state_attr(state.entity_id, "date_of_birth"), "icon": "mdi:cake-layered", "type": "custom:template-entity-row" }}}
,
{%- endfor -%}
Thanks!
EDIT: I should say this is coming from the ha-birthdays integration I installed thru hacs https://github.com/Miicroo/ha-birthdays