DatePicker to get invalid event on wrong input (Vaadin 23)

Hi,
When set e.g. 12/12/0000 actually null is bind to value, but there is no invalid event.
with vaadin 14 I just call function on attach event that callback to server if the parsing fail.
e.g.
datePicker.set(‘i18n.formatDate’, dateObject => moment(dateObject).format(pattern));

    datePicker.set('i18n.parseDate', dateString => {
      const parsed = moment(dateString, pattern);
      if(parsed.isValid() || dateString == ''){
         if(datePicker.invalid == true){
              datePicker.$server.spmlInvalid(false);
          }
          return {
            day: parsed.date(),
            month: parsed.month(),
            year: parsed.year()
          }
      }else{
        datePicker.$server.spmlInvalid(true);
      }
    });

this option seems to be blocked with vaadin 23. I wonder what will be the easiest path to recompose something that will work.
I’m not sure it doable without extend DatePicker’s client side.
Any idea will be welcome.
Thanks

p.s. interesting but this actually block the usage on the date picker only when compile with ‘production’ goal.

as now null is coming back as value i simply create this condition in order to set DatePicker to invalid state.
if getValue() is null, AND
getElement().getProperty(“_hasInputValue”) is true
it means that parse was fail
any ideas still welcom :slightly_smiling_face:

Did you know that DatePicker in Flow is actually nowadays coming with date-fns date formatting cababilites with API under DatePickerI18n to set date formats?

Furthermore, there is now additional default validator in DatePicker that is in sync with client side validation, including incorrect date format input, which makes it usable with Binder. This is by default not on, but can be enabled with feature flag.

So your JavaScript formatting call, should be pretty much obsolete now.

Thanks. i will check that out