Duration attribute template?

It’s not an attribute. It is a property of the state object.

See: State objects - Home Assistant

This will give you the timestamp when the entity last changed:

{{ states.input_text.note_med.last_changed }}

This will give the duration:

{{ relative_time(states.input_text.note_med.last_changed) }}