Prefer the Java standard library instead of Joda-Time
MSALBefore Java 8, Java lacked a robust date and time library, leading to the widespread use of Joda-Time to fill this gap. With the release of Java 8, the java.time package was introduced, incorporating most of Joda-Time's concepts. Features deemed too specialized or bulky for java.time were included in the ThreeTen-Extra library. This recipe migrates Joda-Time types to java.time and threeten-extra types.
org. openrewrite. java. joda. time. NoJodaTimemod run . --recipe= org. openrewrite. java. joda. time. NoJodaTimeInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Add Gradle or Maven dependency
org.threeten:threeten-extra:1.8.0 - Change method name
org.joda.time.base.AbstractDateTime getHourOfDay()togetHour - Change method name
org.joda.time.base.AbstractDateTime getMinuteOfHour()togetMinute - Change method name
org.joda.time.base.AbstractDateTime getSecondOfMinute()togetSecond - Change method name
org.joda.time.base.AbstractDateTime getMonthOfYear()togetMonthValue - Change method name
org.joda.time.DateTime withZone(org.joda.time.DateTimeZone)towithZoneSameInstant - Change method name
org.joda.time.DateTime withZoneRetainFields(org.joda.time.DateTimeZone)towithZoneSameLocal - Change method name
org.joda.time.DateTime withMonthOfYear(int)towithMonth - Change method name
org.joda.time.DateTime withHourOfDay(int)towithHour - Change method name
org.joda.time.DateTime withMinuteOfHour(int)towithMinute - Change method name
org.joda.time.DateTime withSecondOfMinute(int)towithSecond - Change method name
org.joda.time.Duration standardDays(long)toofDays - Change method name
org.joda.time.Duration standardHours(long)toofHours - Change method name
org.joda.time.Duration standardMinutes(long)toofMinutes - Change method name
org.joda.time.Duration standardSeconds(long)toofSeconds - Change method name
org.joda.time.Duration millis(long)toofMillis - Change method name
org.joda.time.Duration getStandardDays()totoDays - Change method name
org.joda.time.Duration getStandardHours()totoHours - Change method name
org.joda.time.Duration getStandardMinutes()totoMinutes - Change method name
org.joda.time.Duration getStandardSeconds()togetSeconds - Change method name
org.joda.time.DateTimeZone forID(String)toof - Change method name
org.joda.time.Instant getMillis()totoEpochMilli - Change method name
org.joda.time.base.BaseDuration getMillis()totoMillis - Change method name
org.joda.time.ReadableDuration getMillis()totoMillis - Change method name
org.joda.time.LocalDate getMonthOfYear()togetMonthValue - Change method name
org.joda.time.LocalDate withMonthOfYear(int)towithMonth - Change method name
org.joda.time.LocalTime getHourOfDay()togetHour - Change method name
org.joda.time.LocalTime getMinuteOfHour()togetMinute - Change method name
org.joda.time.LocalTime getSecondOfMinute()togetSecond - Change method name
org.joda.time.LocalTime withHourOfDay(int)towithHour - Change method name
org.joda.time.LocalTime withMinuteOfHour(int)towithMinute - Change method name
org.joda.time.LocalTime withSecondOfMinute(int)towithSecond - Migrate Joda-Time
DateTimetojava.time.ZonedDateTime - Migrate Joda-Time
AbstractInstantto Java time - Migrate Joda-Time
Durationto Java time - Migrate Joda-Time
Intervalto Java time - Migrate Joda-Time
LocalDatetojava.time.LocalDate - Migrate Joda-Time
LocalTimetojava.time.LocalTime - Migrate Joda-Time formatter to Java time
- Migrate Joda-Time property idioms to Java time
- Migrate Joda-Time
DateTimeZoneto Java time - Migrate Joda-Time
DateMidnightto Java time - Migrate Joda-Time
Instantto Java time - Migrate Joda-Time
Days,Hours,Minutes,Secondsto Java time - Change type
DateTimetoZonedDateTime - Change type
ReadableDateTimetoZonedDateTime - Change type
BaseDateTimetoZonedDateTime - Change type
AbstractDateTimetoZonedDateTime - Change type
DateTimeZonetoZoneId - Change type
org.joda.time.format.DateTimeFormattertojava.time.format.DateTimeFormatter - Change type
DateTimeFormattoDateTimeFormatter - Change type
org.joda.time.Durationtojava.time.Duration - Change type
ReadableDurationtoDuration - Change type
BaseDurationtoDuration - Change type
AbstractDurationtoDuration - Change type
org.joda.time.Instanttojava.time.Instant - Change type
AbstractInstanttoInstant - Change type
ReadableInstanttoInstant - Change type
org.joda.time.Intervaltoorg.threeten.extra.Interval - Change type
ReadableIntervaltoInterval - Change type
BaseIntervaltoInterval - Change type
AbstractIntervaltoInterval - Change type
DateMidnighttoZonedDateTime - Change type
org.joda.time.LocalDatetojava.time.LocalDate - Change type
org.joda.time.LocalTimetojava.time.LocalTime - Change type
org.joda.time.LocalDateTimetojava.time.LocalDateTime