Class TwoDigitYearUtil


  • public class TwoDigitYearUtil
    extends Object
    Recalculates two digit years into four digit years, based on the -80 / +19 rule, for LocalDate and LocalDateTime during the convertToModel conversion. For example, 0019-01-01 will be converted to 2019-01-01 and 0090-01-01 to 1990-01-01.
    • Method Detail

      • convert

        public static LocalDate convert​(LocalDate value)
        Converts the given date and updates the year if it has only two digits. Otherwise it simply returns the input value.
        Parameters:
        value - The date that should be converted
        Returns:
        the date adjusted to a year of -80/+19 if the year was below year 100.
      • convert

        public static LocalDateTime convert​(LocalDateTime value)
        Converts the given datetime and updates the year if it has only two digits. Otherwise it simply returns the input value. The time is not affected.
        Parameters:
        value - The datetime that should be converted
        Returns:
        the datetime with date adjusted to a year of -80/+19 if the year was below year 100.