com.github.nagyesta.lowkeyvault.service.key.util.PeriodUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lowkey-vault-app Show documentation
Show all versions of lowkey-vault-app Show documentation
Assembled application of Lowkey Vault.
The newest version!
package com.github.nagyesta.lowkeyvault.service.key.util;
import lombok.NonNull;
import java.time.OffsetDateTime;
import java.time.Period;
import java.time.temporal.ChronoUnit;
public final class PeriodUtil {
private PeriodUtil() {
throw new IllegalCallerException("Utility cannot be instantiated.");
}
public static long asDays(@NonNull final Period period) {
return asDays(period, OffsetDateTime.now());
}
static long asDays(final Period period, final OffsetDateTime relativeTo) {
return ChronoUnit.DAYS.between(relativeTo, relativeTo.plus(period));
}
}