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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:58:45+00:00 2026-06-13T02:58:45+00:00

Okay, I have heard about it but I can confirm now that the Javascript

  • 0

Okay, I have heard about it but I can confirm now that the Javascript Date functionality is a disaster zone. And I have created a monster out of it. I have this Program :

A JSON object contains list of holiday dates and its respective label.
I need to find out the date of 5 business days from today (excluding saturday, sunday and holiday if any which is contained in the JSON object.) Good stuff so far. Then this 5 business days’ date is going to be devoured by the jquery calender as a default selected date which is not included in the fiddle as it is irrelevant. (Note: the start date on the calender is tommorow’s date) Good stuff again. THEN, comes this part: If it is before noon today, I can select tommorow else start date is day after tommorow. I’m elaborating this because it is included in this fiddle.

So the problem is multiple initialization of the function which handles above functionality is not producing consistent result. It was calculating 5 business days on my system, but when i made this fiddle, it is calculating 4. The date of “5th” business days is incremental by 1 on each call.

http://jsfiddle.net/xXQ7j/27/

Anyone!

  • 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-13T02:58:46+00:00Added an answer on June 13, 2026 at 2:58 am

    Your problem is probably caused by timezone issues.

    Whenever possible you should use new Date(y, m, d) to create a date object, rather than supplying a string. In particular, I’ve found that you get a date relative to 00:00 UTC if you specify a string in format yyyy-mm-dd but one relative to local midnight if you use yyyy/mm/dd.

    In any event, I would suggest a different approach:

    1. convert your holiday date into an object, with the date being the key
    2. generate today’s date
    3. if it’s after noon, get tomorrow’s date – d.setDate(d.getDate() + 1)
    4. create an empty array
    5. add one day (per #3 above)
    6. check if the new day is Saturday or Sunday, if so, go back to #5
    7. check if the new day is in the holiday list, if so, go back to #5
    8. add the new date to the array
    9. repeat until you have 10 entries

    That should give you the next 10 business days in your array. Pick the ones you need to fill out your date picker.

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

Sidebar

Related Questions

I have heard that I should avoid using 'order by rand()', but I really
Okay, I have looked hard for this answer, but all the websites, even the
Okay I have a large CRUD app that uses tabs with Forms embedded in
Okay I have updated my code a little, but I am still not exactly
Okay i have two models: posts and comments. as you can think comments has
i have a question about a very hard development thing: its okay choose ios4
Okay so I want to have an image that I select through CSS to
Okay, so my issue is that I have to catch delete and rename events
Okay i know this has been asked a lot but it seems that none
Okay, so we have a rather large solution with about 8 different projects inside

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.