/** * Verifies that the actual {@code LocalDate} is today, that is matching current year, month and day. * <p> * Example: * <pre><code class='java'> // assertion will pass * assertThat(LocalDate.now()).isToday(); * * // assertion will fail * assertThat(theFellowshipOfTheRing.getReleaseDate()).isToday();</code></pre> * * @return this assertion object. * @throws AssertionError if the actual {@code LocalDate} is {@code null}. * @throws AssertionError if the actual {@code LocalDate} is not today. */ public SELF isToday() { Objects.instance().assertNotNull(info, actual); if (!actual.isEqual(LocalDate.now())) throw Failures.instance().failure(info, shouldBeToday(actual)); return myself; }
/** * Verifies that the actual {@code LocalDate} is today, that is matching current year, month and day. * <p> * Example: * <pre><code class='java'> // assertion will pass * assertThat(LocalDate.now()).isToday(); * * // assertion will fail * assertThat(theFellowshipOfTheRing.getReleaseDate()).isToday();</code></pre> * * @return this assertion object. * @throws AssertionError if the actual {@code LocalDate} is {@code null}. * @throws AssertionError if the actual {@code LocalDate} is not today. */ public SELF isToday() { Objects.instance().assertNotNull(info, actual); if (!actual.isEqual(LocalDate.now())) throw Failures.instance().failure(info, shouldBeToday(actual)); return myself; }
LocalDate ld1 = LocalDateTime.ofInstant(instant1, ZoneId.systemDefault()).toLocalDate(); LocalDate ld2 = LocalDateTime.ofInstant(instant2, ZoneId.systemDefault()).toLocalDate(); if (ld1.isEqual(ld2)) { System.out.println("blubb"); }
@Override boolean filter(LocalDate itemDate, LocalDate thresholdDate) { return itemDate.isAfter(thresholdDate) || itemDate.isEqual(thresholdDate); } }, AFTER_OR_EQUALS {
@Override public boolean isDateAllowed(LocalDate someDate) { return someDate.isAfter(LocalDate.now()) || someDate.isEqual(LocalDate.now()); } }
private static boolean isToday(Date date) { boolean today = false; LocalDate ld = new java.sql.Date(date.getTime()).toLocalDate(); if (ld.isEqual(LocalDate.now())) { today = true; } return today; }
@Override public HighlightInformation getHighlightInformationOrNull(LocalDate someDate) { if (selectedDate == null) { return null; } if ((someDate.isAfter(LocalDate.now()) || someDate.isEqual(LocalDate.now())) && (someDate.isBefore(selectedDate) || someDate.isEqual(selectedDate))) { return new HighlightInformation(Color.GREEN, Color.BLACK, "selected period"); } return null; } }
@JsonIgnore public boolean isValidExecutionDateAndTime() { //TODO Should be removed with https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/167 return Optional.ofNullable(this.requestedExecutionDate) .map(d -> d.isEqual(LocalDate.now()) || d.isAfter(LocalDate.now())) .orElse(true) && Optional.ofNullable(this.requestedExecutionTime) .map(d -> d.isAfter(LocalDate.now().atTime(0, 0))) .orElse(true); }
@JsonIgnore private boolean isValidStartDate() { return this.startDate.isEqual(ChronoLocalDate.from(LocalDate.now())) || this.startDate.isAfter(ChronoLocalDate.from(LocalDate.now())); } }
//test data LocalDate startDate = LocalDate.now(); //get current date LocalDate endDate = startDate.plusDays(5); //add 5 days to current date System.out.println("startDate : " + startDate); System.out.println("endDate : " + endDate); for(LocalDate currentdate = startDate; currentdate.isBefore(endDate) || currentdate.isEqual(endDate); currentdate= currentdate.plusDays(1)){ System.out.println(currentdate); }
public static boolean dateInPeriod(LocalDate referenceDate, BookingPeriod period) { if (referenceDate == null || period == null) { return false; } LocalDate start = period.getStart(); LocalDate end = period.getEnd(); return (referenceDate.isEqual(start) || referenceDate.isAfter(start)) && (referenceDate.isEqual(end) || referenceDate.isBefore(end)); } }
private void validate( RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities) { ArgChecker.isTrue( ratesProvider.getValuationDate().isEqual(volatilities.getValuationDateTime().toLocalDate()), "Volatility and rate data must be for the same date"); }
@Override public double currentCash(RatePaymentPeriod period, RatesProvider provider) { if (provider.getValuationDate().isEqual(period.getPaymentDate())) { return forecastValue(period, provider); } return 0d; }
private double currentCashPayment( ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate valuationDate) { double cash = 0d; for (CapitalIndexedBondPaymentPeriod period : bond.getPeriodicPayments()) { if (period.getPaymentDate().isEqual(valuationDate)) { cash += periodPricer.forecastValue(period, ratesProvider); } } return cash; }
@Override public double currentCash(KnownAmountSwapPaymentPeriod period, RatesProvider provider) { if (provider.getValuationDate().isEqual(period.getPaymentDate())) { return forecastValue(period, provider); } return 0d; } }
@Override public double currentCash(FxResetNotionalExchange event, RatesProvider provider) { if (provider.getValuationDate().isEqual(event.getPaymentDate())) { return forecastValue(event, provider); } return 0d; }
private void validate(RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider) { ArgChecker.isTrue(ratesProvider.getValuationDate().isEqual(discountingProvider.getValuationDate()), "the rates providers should be for the same date"); }
private void validate(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities) { ArgChecker.isTrue(option.getBarrier() instanceof SimpleConstantContinuousBarrier, "Barrier should be SimpleConstantContinuousBarrier"); ArgChecker.isTrue(ratesProvider.getValuationDate().isEqual(volatilities.getValuationDateTime().toLocalDate()), "Volatility and rate data must be for the same date"); }
private void validate(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities) { ArgChecker.isTrue(option.getBarrier() instanceof SimpleConstantContinuousBarrier, "barrier should be SimpleConstantContinuousBarrier"); ArgChecker.isTrue( ratesProvider.getValuationDate().isEqual(volatilities.getValuationDateTime().toLocalDate()), "Volatility and rate data must be for the same date"); }
private double currentCashCouponPayment(ResolvedFixedCouponBond product, LocalDate referenceDate) { double cash = 0d; for (FixedCouponBondPaymentPeriod period : product.getPeriodicPayments()) { if (period.getPaymentDate().isEqual(referenceDate)) { cash += period.getFixedRate() * period.getNotional() * period.getYearFraction(); } } return cash; }