Code uses getMinutes() instead of getUTCMinutes() which results in 30 minutes gap in case local timezone is not round of in hours.