I'd suggest Yanfly's
Buffs & States Core. It offers a <State x Turns: +y> tag for skills/items, nice and simple. It also offers the <Custom Apply Effect> notetag for states, so you can set the duration via script when the state gets applied, e.g.
Code:
<Custom Apply Effect>
var turns = $gameVariables.value(1);
user.setStateTurns(stateId, turns);
</Custom Apply Effect>
This, verbatim, will set the state's duration to the value of game variable 1; just replace the 1 with the variable ID you want to reference.
🙏
Also, in case it helps: you can get the current turn count with this~
Edit: just noticed this is in Learning JavaScript, so I'll add some more explanation. Note that both
stateTurns and
setStateTurns are methods added by Yanfly's Buffs & States Core. The real use of the plugin here is to give an appropriate trigger for the script call. State turn counts are stored in an array on the battler, so you can, for example, set state 5's duration to 3 turns like this: