Package org.linkki.util
Class TwoDigitYearUtil
java.lang.Object
org.linkki.util.TwoDigitYearUtil
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 Summary
Modifier and TypeMethodDescriptionstatic LocalDateConverts the given date and updates the year if it has only two digits.static LocalDateTimeconvert(LocalDateTime value) Converts the given datetime and updates the year if it has only two digits.
-
Method Details
-
convert
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
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.
-