Jquery date rule not working in firefox and IE

后端 未结 2 1450
栀梦
栀梦 2021-01-25 12:38

I have rendered the normal text with jquery date rule. The date rule working fine in chrome but not working in the Firefox and IE . please see my code block.

2条回答
  •  梦谈多话
    2021-01-25 13:14

    This issue is due to the date parsing behavior difference between the browsers. You can see the below.

    Chrome

    new Date("92/12/2015") - Invalid Date

    FireFox

    new Date("92/12/2015") - Date {Sun Jun 07 1998 00:00:00 GMT+0530 (India Standard Time)}

    The date rule will only check for format based on inputted date value and hence the validation succeeded in FF.

    So as @SomekidwithHTML proposed you can use the dateIso which will check the date against ISO date standards or implement your our custom validation as per your need.

    http://jqueryvalidation.org/jQuery.validator.addMethod/

提交回复
热议问题