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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:52:31+00:00 2026-06-17T07:52:31+00:00

I have this function in JS and its a very strange because works with

  • 0

I have this function in JS and its a very strange because works with many dates but with one not..

I have two inputs and with jquery copy the first in the second if the second is minor or is null, and then if i put another greater date in the first, the second date changes to the same at the first.

But I have one case that the first input has 01/05/2013 and in the second has 31/05/2013, if i change the first to 01/06/2013 the second should be change at the same date, but dont do it..

And if with firebug i test it and this function

  obtenerFecha(fIni) > obtenerFecha(fFin) // obtenerFecha(01/06/2013) > obtenerFecha(31/05/2013)

returns false, and its true!

Here is my code if someone can help me..

    function copiarFecha(inicio,fin) {
        var fIni = $("#" + inicio).val();
        var fFin = $("#" + fin).val();
        if ((fFin == "") || obtenerFecha(fIni) > obtenerFecha(fFin)) {
            $("#" + fin).attr('value', fIni);
        }
        return true;
    }


    function obtenerFecha(strFecha) {
        var df = strFecha.split("/");
        if (isNaN(df[0]) || isNaN(df[1]) || isNaN(df[2]) || (df[0] > 31) || (df[1] > 12)) {
            cargaMensaje("KO", "La fecha no es correcta,revísela.");
            return false;
        }
        return new Date(df[2], df[1], df[0]);

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-17T07:52:32+00:00Added an answer on June 17, 2026 at 7:52 am

    You need to subtract 1 from the months. http://jsbin.com/eqozic/2/

    month

    Integer value representing the month, beginning with 0 for January to 11 for December.

    https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date

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

Sidebar

Related Questions

I have added some animation using jquery but it's not working: $('.test-container').click(function(){ $(this).css('background-color', 'rgb(119,
Still kinda new to ASP.net and I have this strange problem. Its a very
I have this function. And its goal is to take the last character first
Strange Question i guess but i have this bit of code in my page...
This is acting very strange and I don't quite have any idea why. I'm
I have a very strange issue with JQuery, its about a starting of JQuery
I've noticed some very strange behaviour today in Code Igniter. I have this locations
I have a very strange problem in developing MFC programming. I used connect() function
I have this function in my onDestroy function and it's causing a crash: @Override
I have this function: int firstHeapArray (IntHeapArray h) { if(!emptyHeapArray(h)) return h.array[0]; } It's

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.