You are viewing documentation for Vaadin Framework 8 and related products View documentation for Vaadin Framework 7 ›
Custom Validators · Vaadin
Vaadin Elements - Date Picker - Custom Validators

Custom Validators

The vaadin-date-picker implements the IronValidatableBehavior, so it supports custom validators registered with an iron-meta element. The validator to be used is defined using the validator property. Notice that it has to be registered with an iron-meta element to be available. See the code example below for details.

  label="Only this year is accepted">

  new Polymer.IronMeta({
    type: 'validator',
    key: 'this-year-validator',
    value: {
      validate: function(value) {
        var currentYear = new Date().getFullYear();
        return new Date(value).getFullYear() === currentYear;