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

  • Home
  • SEARCH
  • 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 8626081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:56:19+00:00 2026-06-12T07:56:19+00:00

I just started to use javascript since few days. Actually I try do display

  • 0

I just started to use javascript since few days.

Actually I try do display an error if a date is inferior to an other date, so I’ve done the following function:

<script type="text/javascript">
function verif_prescription()
{
    var date1= document.getElementById('date1').value;
    var date2= document.getElementById('date3').value;
    if(date1>date2)
    {
        alert('Vous ne pouvez pas avoir une date de prescription inferieure a la date d\'emission');
        document.getElementById('enreg1').setAttribute('disabled','disabled');
    }
    else
    {
        document.getElementById('enreg1').removeAttribute('disabled')
    }
}
</script>

But actualy it does not work for all dates for example if I have on date1= 23-04-2010 and on date3 = 22-04-2012 it display the error, but it should not. SO I think it does not compare the error, I’ve been looking for something to do like in php but I did not find anything.

Kind regards.
SP

  • 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-12T07:56:20+00:00Added an answer on June 12, 2026 at 7:56 am

    http://jsfiddle.net/rd13/vnMUZ/

      var date1 = "23-04-2012".split('-');
      var date2 = "22-04-2012".split('-');
    
      var d1 = new Date(date1[2], date1[1], date1[0]);
      var d2 = new Date(date2[2], date2[1], date2[0]);
    
      document.write(d1 > d2);
    

    or:

    new Date(Date.parse("08/11/2012","dd/MM/yyyy"));
    

    Date.parse(“24-04-2012”); // Wouldn’t work unless you specify the format as being dd/mm/yyy, i.e. UK format.

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

Sidebar

Related Questions

I'm very new to JavaScript (just started a few hours ago and trying to
I just started to use Liferay and I want to develop a portlet using
I just started to use doxygen and may not be familiar with all available
I just started to use SQL Server 2008. I have a winforms application that
I just started to use WCF Rest project template to design a REST service,
I just started to use symfony 1.4 and Doctrine. (Used 1.0 - 1.2 +
I just started to use Guice. When I am using Guice my application classes
I have just started to use ServiceStack which is an amazing library. However, I
I am little more than beginner PHP programmer and just recently started to use
I just started to learn how to use action listeners. To my understanding it

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.