Create a new date from date - (minus) the UTC offset
<pre><code>submitButton.addEventListener(
    "click", function(e) {
        e.preventDefault();

        validateTimeDate();

        if(!timeInPast &amp;&amp; !dateInPast) {
            var hour = parseInt(hourInput.value);
            var day = parseInt(dayInput.value);

            var utcOffset = parseInt(timezoneInput.value);
            var newHour = hour - utcOffset;
            if(hour &lt; 0) {
                day--;
                hour = 24 + utcOffset;
            }
        }
    }
);
</code></pre>

<p>I have the following code, where I'm attempting to validate whether the date/time that is currently being worked with is past the current time/date. I'm attempting to add timezone support, so I have a UTC offset (-12, 12) range. I made a start by attempting to deduct the UTC offset hours from the current working hour, and if this sets the hour below 0, deduct from the day and remove the offset from hour many hours are in a day.</p>

<p>But this is going to get really messy, because as well as day, I'm going to have to do the same for month, year, etc.</p>

<p>I'm wondering if there's a way to take a Date object and make a new Date object or translate this date object against a UTC offset? I could them simply do <code>if(offsetDate &lt; new Date() {</code></p>

<p>(I haven't provided my full code, as I'm not having an issue with the actual execution of the code, simply the logic behind it/approach)</p>