Class TwoDigitYearLocalDateConverter

  • All Implemented Interfaces:
    com.vaadin.flow.data.converter.Converter<LocalDate,​LocalDate>, Serializable

    public class TwoDigitYearLocalDateConverter
    extends Object
    implements com.vaadin.flow.data.converter.Converter<LocalDate,​LocalDate>
    Converts LocalDate to LocalDate while recalculating two digit years into four digit years based on the -80 / +20 rule during the convertToModel conversion. E.g. 19/01/01 will be converted to 2019/01/01 and 90/01/01 to 1990/01/01.
    See Also:
    Serialized Form
    • Constructor Detail

      • TwoDigitYearLocalDateConverter

        public TwoDigitYearLocalDateConverter()
    • Method Detail

      • convertToModel

        @CheckForNull
        public com.vaadin.flow.data.binder.Result<LocalDate> convertToModel​(@CheckForNull
                                                                            LocalDate value,
                                                                            com.vaadin.flow.data.binder.ValueContext context)
        Specified by:
        convertToModel in interface com.vaadin.flow.data.converter.Converter<LocalDate,​LocalDate>
      • convertToPresentation

        public LocalDate convertToPresentation​(LocalDate value,
                                               com.vaadin.flow.data.binder.ValueContext context)
        Specified by:
        convertToPresentation in interface com.vaadin.flow.data.converter.Converter<LocalDate,​LocalDate>