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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:16:27+00:00 2026-06-05T11:16:27+00:00

I am using Date.js to display some dates and a weird thing happens. If

  • 0

I am using Date.js to display some dates and a weird thing happens. If I use it in an array formed from within an each statement.

Here is what i mean:

If I pass and use the events_array to the test function array everything works fine, but if I use the eventsArray one, that should look the same, I get:

startDate is undefined
...new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate()).getTime()...

function getTest() {
    $.ajax({
        type: "GET",
        url: "/index",
        dataType: "json",
        success: function (data) {

            var eventsArray = new Array();

            jQuery.each(data, function (i, val) {

                eventsArray.push(
                new Array({
                    startDate: new Date(2011, 07, 20, 15, 50),
                    endDate: new Date(2012, 00, 10),
                }));
            });

            var events_array = new Array({
                startDate: new Date(2011, 07, 20, 15, 50),
                endDate: new Date(2012, 00, 10),
            }, {
                startDate: new Date(2011, 07, 20, 15, 50),
                endDate: new Date(2012, 00, 10),
            });

          test(events_array);

        }
    });
}

Any ideas?

Thanks

  • 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-05T11:16:28+00:00Added an answer on June 5, 2026 at 11:16 am

    You probably meant to fill eventArray with objects, not arrays with a single object in each one:

    eventsArray.push({ // NOT new Array...
        startDate: new Date(2011, 07, 20, 15, 50),
        endDate: new Date(2012, 00, 10)
    }); });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the date() function to display a timestamp from my databse. $date
Using VB.NET I want to display the date in datetimepicker from the database. Code.
I m using a rich:calendar to display Date in my application But some how
i'm using jqplot 1.0.0b1_r746. i want to display some time periods using the date
Im using the Datepicker control to get a date and display it in a
I am using DateField to display the Date and Time in my Blackberry Program,if
I'm trying to find out how I can display dynamic date and time using
Trying to display current time with PHP (using this ): $date = date('m/d/Y h:i:s
I'm using the code provided below to display time and date. can anyone help
I want to subtract one date to another using php and display result in

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.