0

I want a validation for no past dates i.e something like

StartDate>=Today

Is this possible can anyone help? Thanks...

1
  • @RobWindsor, the first hit on that query is already pointing to this question. So your comment causes and endless loop, human stack overflow :D ⁽ᶦ ᵈᵒ ʰᵃᵛᵉ ᵃ ˢᵉʳᶦᵒᵘˢ ᵖᵒᶦᶰᵗ ᵗʰᵒᵘᵍʰ⁾
    – eirikb
    Commented May 2, 2014 at 6:43

2 Answers 2

2
var startDateStr = $("#startdate").val();
var startDateArr = startDateStr.split("/");
var startDate = new Date(startDateArr[2], startDateArr[0], startDateArr[1]);
var todayDate = new Date();

if (startDate >= todayDate) {
   $("<div class=\"message-warning\">Your Message!</div>")
    .insertAfter("#enddate");
};
1
  • Anuja, using this, can i compare two date time fields?
    – samolpp2
    Commented Nov 2, 2015 at 9:27
1

Please check this link

If the result is in negative return false in PreSaveAction() check here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.