开发者

how to validate the date that it should not be before than today?

开发者 https://www.devze.com 2023-03-07 22:14 出处:网络
I m inserting date and the validat开发者_运维百科ion is it should not be before date than today.

I m inserting date and the validat开发者_运维百科ion is it should not be before date than today.

I m using jquery datepicker.


You can do something like this

if (datePickerID.getTime() < date.getTime()) {
    write your logic here
}


Use RangeValidator control. Set the ControlToValidate to your TextBox control. Set the Type property to Date. And, set the MaximumValue to the current date...

Refer to Validation - RangeValidator


You can use the option minDate, if you don't want user to be able select any date before a particular date.

$( ".selector" ).datepicker( "option", "minDate", new Date());
//Will set the minimum date that the user can select to Today.

Demo

0

精彩评论

暂无评论...
验证码 换一张
取 消