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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:33:36+00:00 2026-05-15T09:33:36+00:00

I have 2 arrays for the dates. I don’t understand why the first element

  • 0

I have 2 arrays for the dates. I don’t understand why the first element works, and the second doesn’t works. That is the same function. Second and third (4th 5th… etc ) should work. I don’t understand. Maybe it’s bug of datepicker, because I also cannot use the onChange function.

[2010,8,10] – [2010,8,15] -> works
[2010,7,10] – [2010,7,10] -> doesn’t works.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html lang="en">
<head>
    <title>jQuery UI Datepicker - Default functionality</title>

    <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript" src="js/ui/ui.core.js"></script>
    <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>

<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
  td.odd, table.ui-datepicker-calendar tbody td.odd a { background: yellow; }
  td.odd2, table.ui-datepicker-calendar tbody td.odd2 a { background: red; bgcolor: red; }
</style>

    <script type="text/javascript">


var start_date = [
 [2010,8,10], [2010,7,10] 
 ];

var end_date = [
 [2010,8,15], [2010,7,15] 
 ]; 

function nationalDays(date) {

var year = 0;
var month = 1;
var day = 2

 for (i = 0; i < start_date.length; i++) {

    if (

        ( ( start_date[i][year] <= date.getFullYear() ) && ( date.getFullYear() <= end_date[i][year] ) ) && 

        ( ( start_date[i][month]-1 <= date.getMonth() ) && ( date.getMonth() <= end_date[i][month]-1 ) ) && 

        ( ( start_date[i][day] <= date.getDate() ) && ( date.getDate() <= end_date[i][day] ) ) 

    ) {  
    //( start_year <= now_year <= end_year )  && ( start_month <= now_month <= end_month )  && ( start_day <= now_day <= end_day )

            return [true, 'odd2'];

    } else { 

            return [false, 'odd2'];

    }           
 }
}

    $(function() {
        $(".datepicker").datepicker({
            beforeShowDay: nationalDays,
            showOn: 'button', buttonImage: 'images/calendar_icon.jpg', buttonImageOnly: true,
            numberOfMonths: 3,
            dateFormat: 'dd/mm/yy',
            showButtonPanel: false,
            closeText: 'X' ,
            currentText: 'Now',
            constrainInput: true,
            stepMonths: 3,
            firstDay: 1,
            monthNames: ['Januar','Februar','Marts','April','Maj','Juni','Juli','August','September','Oktober','November','December'],
            nextText: 'Later',
            prevText: 'Earlier',
            minDate: '-0d',
            maxDate: '+1y'
        });
    });

    </script>
</head>
<body>

<table>
<tr>

    <td><p>Date: <input type="text" name="date2" value="" size="20" readonly="readonly" class="datepicker"></p></td>

</tr>
</table>


</body>
</html>
  • 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-15T09:33:36+00:00Added an answer on May 15, 2026 at 9:33 am

    I’m having a hard time parsing if block, but I don’t think it matters. I’m guessing it’s because you’re returning false once it doesn’t match your first set of dates, so your loop will never get past the first iteration.

    I think you want to move the return false outside of your loop…

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

Sidebar

Related Questions

I have 2 arrays of 16 elements (chars) that I need to compare and
I have several arrays of arrays or arrays of dicts that I would like
I have two arrays containing the same elements, but in different orders, and I
I have two arrays in PHP. The first array ($author_array) is comprised of user_ids
I have two arrays built while parsing a text file. The first contains the
A PHP array can have arrays for its elements. And those arrays can have
serial.write() method in pyserial seems to only send string data. I have arrays like
I have two arrays of animals (for example). $array = array( array( 'id' =>
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
I have two arrays. One contains id=>count and the other contains id=>name . I'm

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.