The code. You can also easily extend this to include days or weeks: Your code does suffer from one downside: if for some reason the calls become slightly further apart, this might increasingly build a delay. Hope you will like it.subscribe and turn on the no. I hope this helps someone. Making statements based on opinion; back them up with references or personal experience. . Then base your logic on the current time value, instead of counting how often your callback has been executed. Step 3 : Output the resultIn the code below the result is given as output by id=demo. The date and month of birth are used to calculate if the birthday has gone this year or is in the same year. This will cause the clock to only display once the initializeClock function is called: Next we can specify the dates between which the clock should show up. All we need to do here is replace the deadline variable with this: This code takes the current time and adds ten minutes. Heres what that looks like: First, were creating a variable total, to hold the remaining time until the deadline. */, /** The question should be more like "I don't get the advantage over calling one single method with multiple arguments" as it requires less memory in larger scales. The same happens with timer, you can start the timer with any date compared to now, and then set as many elements as you want to have the same timer on it, not just one :D. As you can see, we have a pattern that keeps on repeating.