0

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?

loyalflow
  • 14,275
  • 27
  • 107
  • 168

1 Answers1

2

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>
Seany84
  • 5,526
  • 5
  • 42
  • 67
  • Is it possible for me to output the current format, and see if that your snippet changes it? – loyalflow Feb 19 '14 at 17:42
  • Refer to the Globalize documentation: https://github.com/jquery/globalize#core I believe this is referring to your other question. – Seany84 Feb 19 '14 at 23:02