I’ve tried strptime(), timestamp() and a bunch of other things but keep getting various errors (I’m pretty sure it’s related to the value being a string, but can’t seem to format it correctly)
Your “code” isn’t very helpful since we can’t tell what you expect Test to actually take in or do with what it takes in. (As far as I’m concerned, it probably does stuff, so what’s wrong?)
Show us the state of the helper and then give us an idea of what Test is actually going to do. The latter is important at least since you say you’re only working with a time and not a date.
My apologies, did not add states() in my hastily typed example, did I. I’ve corrected my example.
I was looking for the correct way to convert the string from states() to a usable date time. I believe today_at() will work as it simply adds todays date to the time string.
The state of a time only helper is only a string containing time so jinja doesn’t know what to do with it apparently (it wants a whole datetime object). I needed a way to easily make it useful to jinja so I can use the time set in the frontend within various macros. I’ll need to do some testing, but it seems today_at() works to convert the time string to an actual datetime so jinja use it.
It seems silly to convert it to a datetime in the call just to parse the hrs/ mins back out in the macro, but it gives me errors if I don’t.