Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7064717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:52:07+00:00 2026-05-28T04:52:07+00:00

I have a function calls that start a bunch of timers and I want

  • 0

I have a function calls that start a bunch of timers and I want to add a few minutes to each one so they don’t all start off at zero. I had success with:

var currentDate = new Date();
var twentyMinutesLater = new Date(currentDate.getTime() + (20 * 60 * 1000));
new CountUp(twentyMinutesLater, 'counter03');

I would love to skip creating the var twentyMinutesLater and so on for all the timers I want, I just can’t get the syntax right, or maybe it’s not possible. Is there a way to add the milliseconds that in the function call below.

new CountUp(new Date(), 'counter03');

I’ve tried:

new CountUp((new Date() + (20 * 60 * 1000)), 'counter03');

Result NaN NaN:NaN:NaN so it’s not a number
Same result with double quotes.

Any javascript syntax masters out there that have any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:52:08+00:00Added an answer on May 28, 2026 at 4:52 am

    In your specific code, you’re passing a Date object to the counter code and that is not what it is expected. It is expecting a time value from which it will make it’s own Date object (you can see that right in the constructor for the Counter function). Plus, the counter code won’t take times in the future, only times in the past (perhaps because it doens’t want to deal with negative times – I don’t know).

    Here’s a working example here where I’ve modified my other jsFiddle used in the answer to your other question.

    function addCounter() {
        var currentDate = new Date();
        var twentyMinutesLater = currentDate.getTime() - (20 * 60 * 1000);
        var div = document.createElement("div");
        div.id = "counter" + counterNum++;
        document.body.appendChild(div);
        new CountUp(twentyMinutesLater, div.id);
    }
    

    And, here’s a jsFiddle that lets you enter a number of minutes and it will start a counter at that value: http://jsfiddle.net/jfriend00/vnf5z/.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a javascript that calls a function each 1 minute. That function sends
I have a function that calls out a read or write request on a
I have a function that calls itself to increment and decrement a stack. I
I have a javascript function that calls a generic function to make an ajax
I have a function in my application that calls various subfunctions depending on the
I have link that calls a function when clicked: <a href=javascript:spawnMenu(this); id=link1>Test1</a> To make
I have a simple recursive function RCompare() that calls a more complex function Compare()
I have created a function in PHP that calls a webservice and parses through
I have an IF statement that consists of two separate function calls passing values
I have a function that makes a series of calls to sscanf() and then,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.