In [this post](https://stackoverflow.com/questions/26922766/website-countdown-js) someone (royhowie) shared a js that counts to every sunday. This code works well but when I try to make it work for days beyond today (current day), like tuesday, monday by changing delta value from 7 to 2 or 1, this show Timer's Finished. How to make it work?

```js
var getNextSunday = function () {
    var today = new Date(),
        day = today.getDay(), // 1 for Mon, 2 for Tue, 3 for Wed, etc.
        delta = 7 - day;

    var sunday = new Date(today.getTime() + (delta * 24 * 3600 * 1000));

    sunday.setHours(11);
    sunday.setMinutes(15);
    sunday.setSeconds(0);

    return sunday;
}

var t = getNextSunday(),
    p = document.getElementById("time"),
    timer;
var u = function () {
    var delta = t - new Date(),
        d = delta / (24 * 3600 * 1000) | 0,
        h = (delta %= 24 * 3600 * 1000) / (3600 * 1000) | 0,
        m = (delta %= 3600 * 1000) / (60 * 1000) | 0,
        s = (delta %= 60 * 1000) / 1000 | 0;

    if (delta < 0) {
        clearInterval(timer);
        p.innerHTML = "timer's finished!";
    } else {
        p.innerHTML = d + "d " + h + "h " + m + "m " + s + "s";
    }
}
timer = setInterval(u, 1000);
```

```html
<h1 id="time"></h1>
```

Solved
======

@Reti43 Gentleman you are genius. Lots of respect for you.