You pointed out this problem correctly. I was amazed how many incorrect "solutions" people offer, ignoring this "overflow" problem you noticed!
One of the right ways is converting time into milliseconds and adding required duration in milliseconds:
momentOfTime = new Date();
myTimeSpan = 5*60*1000;
momentOfTime.setTime(momentOfTime.getTime() + myTimeSpan);