Fixed issue with javascript time remaining calculation