How to use Globalize.js to change the date format that validation uses?

6.4k Views Asked by At

I have the globalize.js file, and I want to force the dateformat to dd/mm/yyyy at a global level somewhere so then all jquery validation and datepicker etc. will pickup this dateformat.

Is this possible?

1

There are 1 best solutions below

2
Seany84 On

I believe the following applied in your layout would suffice:

<script type="text/javascript">
    $(function () {
        $.validator.methods.date = function (value, element) {
            return this.optional(element) || Globalize.parseDate(value, "dd/MM/yyyy") !== null;
        }
    });
</script>