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 9139023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:20:00+00:00 2026-06-17T09:20:00+00:00

Code jsFiddle: http://jsfiddle.net/14rego/gEUJz/ I’m building an array of dates using these functions. Both work

  • 0

Code jsFiddle: http://jsfiddle.net/14rego/gEUJz/

I’m building an array of dates using these functions. Both work great in webkit browsers, but I know IE is pickier about dates.

nextDayA() works in IE as long as the months don’t include August or September. I spent hours trying to figure it out before deciding to try nextDayB(), which I would think would work on any browser anywhere since it doesn’t include the Date function, but it doesn’t work at all in IE.

I don’t care which one I use, as long as it works. I simply need to get the correct dates in order. I have a bit of experience, but I’m certainly not a guru. Can anyone shed some light?

$.nextDayA = function (year, month, day) {
    var jMo = parseInt(month) - 1;
    var today = new Date(year, jMo, day);
    var tomorrow = new Date(today.getTime() + (24 * 60 * 60 * 1000));
    var nextDy = tomorrow.getDate();
    var nextMo = tomorrow.getMonth() + 1;
    var nextYr = tomorrow.getFullYear();
    if (nextDy < 10) { nextDy = '0' + nextDy; }
    if (nextMo < 10) { nextMo = '0' + nextMo; }
    var tomDate = parseInt(nextYr + '' + nextMo + '' + nextDy);
    return tomDate;
};
$.nextDayB = function (year, month, day) {
    var thisYear = parseInt(year);
    var thisMonth = parseInt(month);
    var thisDay = parseInt(day);
    if (year % 4 == 0) {
        var leap = 'yes';
    } else {
        var leap = 'no';
    }
    var nextDy = thisDay + 1;
    if (nextDy > 28 && thisMonth === 2 && leap === 'no') {
        var nextDy = 1;
        var nextMo = thisMonth + 1;
    } else if (nextDy > 29 && thisMonth === 2 && leap === 'yes') {
        var nextDy = 1;
        var nextMo = thisMonth + 1;
    } else if (nextDy > 30 && (thisMonth === 2 || thisMonth === 4 || thisMonth === 6 || thisMonth === 9 || thisMonth === 11)) {
        var nextDy = 1;
        var nextMo = thisMonth + 1;
    } else if (nextDy > 31 && (thisMonth === 1 || thisMonth === 3 || thisMonth === 5 || thisMonth === 7 || thisMonth === 8 || thisMonth === 10 || thisMonth === 12)) {
        var nextDy = 1;
        var nextMo = thisMonth + 1;
    } else {
        var nextMo = thisMonth;
    }
    if (nextMo === 13) {
        var nextMo = 1;
        var nextYr = thisYear + 1;
    } else {
        var nextYr = thisYear;
    }

    if (nextDy < 10) {
        nextDy.toString();
        var strDy = '0' + nextDy;
    } else {
        var strDy = nextDy.toString();
    }
    if (nextMo < 10) {
        nextMo.toString();
        var strMo = '0' + nextMo;
    } else {
        var strMo = nextMo.toString();
    }

    var strYr = nextYr.toString();
    var strDate = strYr + '' + strMo + '' + strDy;
    var tomDate = parseInt(strDate);
    return tomDate;
};
  • 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-06-17T09:20:01+00:00Added an answer on June 17, 2026 at 9:20 am

    You have to pass a base parameter to parseInt():

    var thisDay = parseInt(day, 10);
    

    If you don’t do that, then strings starting with “0” are interpreted as octal constants, not decimal. Of course, “08” and “09” are meaningless octal constants. The second parameter (10) tells the function that the string should be interpreted as a base 10 string regardless of leading zeros.

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

Sidebar

Related Questions

See here for code: http://jsfiddle.net/ecFBK/10/ I'm having a hard time getting this to work
here is the code: http://jsfiddle.net/bfQMD/11/ Im using flip pluging and how to change opacity.
This code : http://jsfiddle.net/bYtTG/1/ Works as I want in FF, chrome and opera, but
Here's my code : http://jsfiddle.net/d6j6e/ When you click on the gray little rectangle in
here is the code: http://jsfiddle.net/VW8V5/1/ When hover it should start looping but end of
here is the code: http://jsfiddle.net/hQnXm/7/ So basically i need when hover, it should animate
here is the code: http://jsfiddle.net/4WyPq/ So basically when I click 'button1' it animates then
I have this code : http://jsfiddle.net/VAkLn/6/ When i add a table : http://jsfiddle.net/VAkLn/7/ this
This is my code: http://jsfiddle.net/WCP5f/2/ If you open it with Chrome, you will see
here is the code: http://jsfiddle.net/duNHJ/2/ Basically there is an animations every div so when

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.