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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:09:59+00:00 2026-06-08T00:09:59+00:00

I had to build a DatePicker without any Library (like jQuery) for a client.

  • 0

I had to build a DatePicker without any Library (like jQuery) for a client.
I succeeded on my local machine. However my client is using it now and it shows some odd behaviour if its included in his web-app.

If i select the 31st of May and scroll to the next month i end up at July 1st.
The DateObject infact has May 31st before i click the button to fire up the “jumpToNextMonth” function.
I assume the dateObject jumps to June 31st which is nonexistend and then goes one foward to 1st of july.
This happens in August as well and all other 30-day-months which are followed by 31-day-months.

The line which is fired up on click is

this.currentDate = new Date(this.currentDate.getFullYear(),
                           this.currentDate.getMonth() + 1,
                           this.currentDate.getDate());

I don’t see this behaviour on my local machine nor do i see it running an apache server.
I can’t imagine what corrupts the date object on my clients web-app and unfortunately i don’t have access to their files.

I’d really appreciate if you’d help me answering these two questions:

  1. why is it not happening on my local machine
  2. how do i fix it without setting the Day to “1” e.g. this.currentDate = new Date(this.currentDate.getFullYear(), this.currentDate.getMonth() + 1, 1);

I found similar non-answered questions here
Flex Mobile 4.6: DateSpinner dateAndTime jumping from Jan 31st to March 1st

  • 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-08T00:10:02+00:00Added an answer on June 8, 2026 at 12:10 am

    You have answered your own question. June 31st in the object is effectively July 1st.

    Does this solve your issue?

    function daysInMonth(month, year)
    {
        return 32 - new Date(year, month, 32).getDate();
    }
    
    var y = this.currentDate.getFullYear();
    var m = this.currentDate.getMonth() + 1;
    var d = Math.min(this.currentDate.getDate(), daysInMonth(m, y);
    this.currentDate = new Date(y, m, d);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So just this week I had the opportunity to re-build my development machine and
I had someone build out a custom CMS for a small site and now
I had build big application for my client in Android. The new project is
I had to build boost library for threading. So I gave the command ./bootstrap.sh
I have never had to build an array in android like the following, and
Background: I had a build machine with .NET 2.0 SP1 (and no higher) which
I want to deploy my application to some other machine. I had build this
I had build a tree to represent multiple connections between pages and links. And
I was wondering if anyone knew whether Visual Studio .NET had a parallel build
I had been asked to build crystal reports for an application, i used the

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.