public LocalDate getCalendarDateEnd() { LocalDate endDate = null; for (Service service : services.values()) { for (LocalDate date : service.calendar_dates.keySet()) { if (endDate == null || date.isAfter(endDate)) endDate = date; } } return endDate; }
boolean isBetweenInclusive(LocalDate start, LocalDate end, LocalDate target) { return !target.isBefore(start) && !target.isAfter(end); }
LocalDate date = LocalDate.of(2005, 1, 1); // Assign date to check if(date.isBefore(today.minusYears(10)) && date.isAfter(today.minusYears(20))) //Do Something
@Override public void clear() throws CacheException { cachedMap.forEach( ( k, v ) -> { if ( LocalDate.now().isAfter( v.getExceedTime() ) ) { remove( k ); } } ); }
LocalDate now = new DateTime().toLocalDate(); LocalDate plus10days = now.plusDays(10); LocalDate event = new DateTime(year, month, day, 0, 0, 0, 0).toLocalDate(); if (!event.isBefore(now) && !event.isAfter(plus10days)) { // Event is between now and 10 days (inclusive). }
Service service = feed.services.get(trip.service_id); BitSet validOnDay = new BitSet((int) DAYS.between(startDate, endDate)); for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) { if (service.activeOn(date)) { validOnDay.set((int) DAYS.between(startDate, date));
final LocalDate isd = parseDate(issueDate); if(isd.isAfter(today)) { valid = false; msgs.add("License not valid yet.");
if (telemetry.getStart().isAfter(LocalDate.now())) { LOGGER.config("Skipping telemetry for '" + telemetry.getId() + "' as it is configured to start later"); return;
/** * Verifies that the actual {@code LocalDate} is before or equals to the given one. * <p> * Example : * <pre><code class='java'> assertThat(parse("2000-01-01")).isBeforeOrEqualTo(parse("2000-01-01")) * .isBeforeOrEqualTo(parse("2000-01-02"));</code></pre> * * @param other the given {@link LocalDate}. * @return this assertion object. * @throws AssertionError if the actual {@code LocalDate} is {@code null}. * @throws IllegalArgumentException if other {@code LocalDate} is {@code null}. * @throws AssertionError if the actual {@code LocalDate} is not before or equals to the given one. */ public SELF isBeforeOrEqualTo(LocalDate other) { Objects.instance().assertNotNull(info, actual); assertLocalDateParameterIsNotNull(other); if (actual.isAfter(other)) { throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other)); } return myself; }
/** * Verifies that the actual {@code LocalDate} is <b>strictly</b> after the given one. * <p> * Example : * <pre><code class='java'> assertThat(parse("2000-01-01")).isAfter(parse("1999-12-31"));</code></pre> * * @param other the given {@link LocalDate}. * @return this assertion object. * @throws AssertionError if the actual {@code LocalDate} is {@code null}. * @throws IllegalArgumentException if other {@code LocalDate} is {@code null}. * @throws AssertionError if the actual {@code LocalDate} is not strictly after the given one. */ public SELF isAfter(LocalDate other) { Objects.instance().assertNotNull(info, actual); assertLocalDateParameterIsNotNull(other); if (!actual.isAfter(other)) { throw Failures.instance().failure(info, shouldBeAfter(actual, other)); } return myself; }
/** * Verifies that the actual {@code LocalDate} is <b>strictly</b> after the given one. * <p> * Example : * <pre><code class='java'> assertThat(parse("2000-01-01")).isAfter(parse("1999-12-31"));</code></pre> * * @param other the given {@link LocalDate}. * @return this assertion object. * @throws AssertionError if the actual {@code LocalDate} is {@code null}. * @throws IllegalArgumentException if other {@code LocalDate} is {@code null}. * @throws AssertionError if the actual {@code LocalDate} is not strictly after the given one. */ public SELF isAfter(LocalDate other) { Objects.instance().assertNotNull(info, actual); assertLocalDateParameterIsNotNull(other); if (!actual.isAfter(other)) { throw Failures.instance().failure(info, shouldBeAfter(actual, other)); } return myself; }
/** * Verifies that the actual {@code LocalDate} is before or equals to the given one. * <p> * Example : * <pre><code class='java'> assertThat(parse("2000-01-01")).isBeforeOrEqualTo(parse("2000-01-01")) * .isBeforeOrEqualTo(parse("2000-01-02"));</code></pre> * * @param other the given {@link LocalDate}. * @return this assertion object. * @throws AssertionError if the actual {@code LocalDate} is {@code null}. * @throws IllegalArgumentException if other {@code LocalDate} is {@code null}. * @throws AssertionError if the actual {@code LocalDate} is not before or equals to the given one. */ public SELF isBeforeOrEqualTo(LocalDate other) { Objects.instance().assertNotNull(info, actual); assertLocalDateParameterIsNotNull(other); if (actual.isAfter(other)) { throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other)); } return myself; }
@Override protected void checkValues() { if (min.isAfter(max)) { throw new IllegalArgumentException("max must be after min"); } }
String s = "2014-05-01"; String e = "2014-05-10"; LocalDate start = LocalDate.parse(s); LocalDate end = LocalDate.parse(e); List<LocalDate> totalDates = new ArrayList<>(); while (!start.isAfter(end)) { totalDates.add(start); start = start.plusDays(1); }
LocalDate localDate1 = formatter.parseLocalDate( string1 ); LocalDate localDate2 = formatter.parseLocalDate( string2 ); LocalDate localDate3 = formatter.parseLocalDate( string3 ); boolean is1After2 = localDate1.isAfter( localDate2 ); boolean is2Before3 = localDate2.isBefore( localDate3 );
/** * Returns whether the {@link CreditCard} is valid for the given date. * * @param date * @return */ public boolean isValid(LocalDate date) { return date == null ? false : getExpirationDate().isAfter(date); }
LocalDate startDate = new LocalDate(2011, 11, 8); LocalDate endDate = new LocalDate(2012, 5, 1); LocalDate thisMonday = startDate.withDayOfWeek(DateTimeConstants.MONDAY); if (startDate.isAfter(thisMonday)) { startDate = thisMonday.plusWeeks(1); // start on next monday } else { startDate = thisMonday; // start on this monday } while (startDate.isBefore(endDate)) { System.out.println(startDate); startDate = startDate.plusWeeks(1); }
@Test public void testTimezoneDatabasesAreUpToDate() { // ensure the timezone databases are up-to-date String currentTzVersion = Jsoup.parse(browser.driver.getPageSource()).getElementById("tzversion-moment").text(); browser.driver.get(IANA_TIMEZONE_DATABASE_URL); Document tzReleasePage = Jsoup.parse(browser.driver.getPageSource()); String latestTzVersion = tzReleasePage.getElementById("version").text(); if (!currentTzVersion.equals(latestTzVersion)) { // find the release day String releaseDateString = tzReleasePage.getElementById("date").text(); Pattern datePattern = Pattern.compile("\\(Released (.+)\\)"); Matcher matcher = datePattern.matcher(releaseDateString); assertTrue(matcher.find()); LocalDate releaseDate = LocalDate.parse(matcher.group(1), DateTimeFormatter.ofPattern("yyyy-MM-dd")); LocalDate nowDate = Instant.now().atZone(Const.DEFAULT_TIME_ZONE).toLocalDate(); assertTrue( "The timezone database version is not up-to-date for more than " + DAYS_TO_UPDATE_TZ + " days," + " please update them according to the maintenance guide.", releaseDate.plusDays(DAYS_TO_UPDATE_TZ).isAfter(nowDate)); } }
String year = Integer.toString(date.getYear()); if (selectedDate.isAfter(date)) {
@Override public double calculateYearFraction(LocalDate firstDate, LocalDate secondDate, ScheduleInfo scheduleInfo) { long actualDays = daysBetween(firstDate, secondDate); int numberOfLeapDays = 0; LocalDate temp = DateAdjusters.nextLeapDay(firstDate); while (temp.isAfter(secondDate) == false) { numberOfLeapDays++; temp = DateAdjusters.nextLeapDay(temp); } return (actualDays - numberOfLeapDays) / 365d; }