Read through this topic for a better understanding of the Time Input Widget.
This probably is due to bad coding, but you didn’t show what you have, not that this is a code mechanics shop anyhow … Look at this link concerning the scope of variables and how to declare them in your code.