public static TemporalAmount rightShift(final Temporal self, Temporal other) {
        if (!self.getClass().equals(other.getClass())) {
            throw new GroovyRuntimeException("Temporal arguments must be of the same type.");
        }
        switch ((ChronoUnit) defaultUnitFor(self)) {
            case YEARS:
                return DateTimeStaticExtensions.between(null, (Year) self, (Year) other);
            case MONTHS:
                return DateTimeStaticExtensions.between(null, (YearMonth) self, (YearMonth) other);
            case DAYS:
                return ChronoPeriod.between((ChronoLocalDate) self, (ChronoLocalDate) other);
            default:
                return Duration.between(self, other);
        }
    }
public static TemporalAmount rightShift ( final Temporal self , Temporal other ) { if ( ! self . getClass ( ) . equals ( other . getClass ( ) ) ) { throw new GroovyRuntimeException ( "Temporal arguments must be of the same type." ) ; } switch ( ( ChronoUnit ) defaultUnitFor ( self ) ) { case YEARS : return DateTimeStaticExtensions . between ( null , ( Year ) self , ( Year ) other ) ; case MONTHS : return DateTimeStaticExtensions . between ( null , ( YearMonth ) self , ( YearMonth ) other ) ; case DAYS : return ChronoPeriod . between ( ( ChronoLocalDate ) self , ( ChronoLocalDate ) other ) ; default : return Duration . between ( self , other ) ; } }
Returns a {@link java.time.Duration} or {@link java.time.Period} between this (inclusive) and the {@code other}
{@link java.time.temporal.Temporal} (exclusive).
<p>
A Period will be returned for types {@link java.time.Year}, {@link java.time.YearMonth}, and
{@link java.time.chrono.ChronoLocalDate}; otherwise, a Duration will be returned.
<p>
Note: if the Temporal is a ChronoLocalDate but not a {@link java.time.LocalDate}, a general
{@link java.time.chrono.ChronoPeriod} will be returned as per the return type of the method
{@link java.time.chrono.ChronoLocalDate#until(ChronoLocalDate)} .

@param self  a Temporal
@param other another Temporal of the same type
@return an TemporalAmount between the two Temporals
@since 2.5.0