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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:21:04+00:00 2026-05-23T00:21:04+00:00

The code below is giving me trouble. When I select July 1st 11:00pm for

  • 0

The code below is giving me trouble. When I select July 1st 11:00pm for fromDate, result 3 is being set to Thu Jun 02 2011 11:52:26. I check the values of fromDate and toDate in chrome and they seem fine but result 3 is getting set to a wacky date. Any solutions?

function(value, element, params) {
            fromDate = new Date(startDate.val());
            toDate = new Date(endDate.val());
            result1 = this.optional(element);
            result2 = fromDate <= toDate;
            result3 = new Date();
            result3.setDate(fromDate.getDate()+1);
            result5 = (toDate.getDate()+0);
            result4 = (fromDate.getDate()+1)>(toDate.getDate()+0);
            return result1 || (result2 && result4);
        }
  • 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-23T00:21:04+00:00Added an answer on May 23, 2026 at 12:21 am

    result3.setDate(fromDate.getDate()+1) only sets the day of the month of your Date object. Since result3 creates a new Date object, this means that result3 is not having its time set correctly.

    If you want to set result3 to fromDate plus one day, you’ll have to do something like this:

    var DAY_IN_MILLISECONDS = 1000 * 60 * 60 * 24;
    result3 = new Date(fromDate + DAY_IN_MILLISECONDS);
    

    However, since I’m not sure what your variables represent, it’s hard to diagnose.

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

Sidebar

Related Questions

I cannot understand why the code below is giving me this error in firebug
The code below works in FF, Safari, Chrome. But IE is giving me issues.
i am using javax.Mail api with authenticator, but this below code giving Access restriction:
In the code below I am giving the function a sTransactionDate=1999 and I am
What can I do to avoid MISRA giving this error for the code below?
The code below is giving me a flat line for the line of best
hi all below code giving me contact names and phone numbers from contact list
regarding the code below, eclipse is giving me a lot of errors around line
The code below is giving the following error: An expression tree may not contain
I am using the code below but it is giving time out error. Though

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.