Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Powered by Vanilla. Made with Bootstrap.
Copyright by StammTec.de
Please note that access to the support forum is restricted to verified buyers only. To apply for access click here and fill out the form.

Support is offered by this forum only, any other request will be redirected to the forum.
Please read this before you start posting.
input date validate format?
  • Hi Markus,

    What and how i must change for date format change?

    That only User input Date format like dd.mm.yyyy is valid for submit form?

    Can you please introduce me what i must edit?

    Thanks for your Time.

  • msiemens
    Moderator
    Hey peisi,

    you should be able to set the date format using the data-date-format attribute (something like <input type="date" data-date-format="dd.mm.yyyy">).
    Does it work for you?

    Cheers,
    Markus
  • the date is also not valid =(


    <p class="_25">
                <label for="rythmus_datum">Änderung zum:</label>
                <input type="date" name="rythmus_datum[]" data-date-format="dd.mm.yy" class="required"/> 
    </p>


    image

    And jquery.validate.js = 

    date: function( value, element ) {
    return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString());
    },

    dateISO: function( value, element ) {
    return this.optional(element) || /^\d{1,2}\.\d{1,2}\.\d{4}$/.test(value);
    },


    You have a solution?
  • msiemens
    Moderator
    Hey, you can add your own validation like this:

    $.validator.addMethod("dateDE", function(value, element) {
        return this.optional(element) || /^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(value);
    }, "Bitte gib ein korrektes Datum an.");

    You then can enable the new rule by setting data-rule-datede:

    <input type="date" name="rythmus_datum[]" data-date-format="dd.mm.yy" data-rule-datede="true" class="required"/>



    Does this work for you?

    Cheers