use of org.joda.time.LocalDate in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script41_LocalDate.
@Test
public void script41_LocalDate() {
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
Person person = templateFor(Person.class);
Query<Person> query = unitOfWork.newQuery(qb.where(ne(person.localDateValue(), new LocalDate("2010-03-04", UTC))));
System.out.println("*** script41_LocalDate: " + query);
verifyUnorderedResults(query, "Joe Doe");
}
use of org.joda.time.LocalDate in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script42_LocalDate.
@Test
public void script42_LocalDate() {
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
Person person = templateFor(Person.class);
Query<Person> query = unitOfWork.newQuery(qb.where(ne(person.localDateValue(), new LocalDate("2010-03-04", forID("CET")))));
System.out.println("*** script42_LocalDate: " + query);
verifyUnorderedResults(query, "Joe Doe");
}
use of org.joda.time.LocalDate in project qi4j-sdk by Qi4j.
the class DateTextFieldWithPicker method earliestDate.
public DateTextFieldWithPicker earliestDate(LocalDate newEarliestDate) {
if (selectedDate != null && newEarliestDate.isAfter(selectedDate)) {
throw new IllegalArgumentException("Earliest date can't be before selected day.");
}
earliestDate = newEarliestDate;
// Input field validation - date should be _after_ minimumDate (not the same)
LocalDate minimumDate = newEarliestDate.minusDays(1);
Date convertedMinimumDate = new DateTime(minimumDate.toDateTime(new LocalTime())).toDate();
add(DateValidator.minimum(convertedMinimumDate));
return this;
}
use of org.joda.time.LocalDate in project SeriesGuide by UweTrottmann.
the class TimeTools method parseEpisodeReleaseDate.
/**
* Calculates the episode release date time as a millisecond instant. Adjusts for time zone
* effects on release time, e.g. delays between time zones (e.g. in the United States) and DST.
*
* @param showTimeZone See {@link #getDateTimeZone(String)}.
* @param showReleaseTime See {@link #getShowReleaseTime(int)}.
* @return -1 if no conversion was possible. Otherwise, any other long value (may be negative!).
*/
public static long parseEpisodeReleaseDate(@Nullable Context context, @NonNull DateTimeZone showTimeZone, @Nullable String releaseDate, @NonNull LocalTime showReleaseTime, @Nullable String showCountry, @Nullable String showNetwork, @NonNull String deviceTimeZone) {
if (releaseDate == null || releaseDate.length() == 0) {
return Constants.EPISODE_UNKNOWN_RELEASE;
}
// get date
LocalDate localDate;
try {
localDate = TVDB_DATE_FORMATTER.parseLocalDate(releaseDate);
} catch (IllegalArgumentException e) {
// date string could not be parsed
if (context != null) {
Utils.trackCustomEvent(context, AnalyticsTree.CATEGORY_THETVDB_ERROR, "Date parsing failure", releaseDate);
}
Timber.e(e, "TheTVDB date could not be parsed: %s", releaseDate);
return Constants.EPISODE_UNKNOWN_RELEASE;
}
// set time
LocalDateTime localDateTime = localDate.toLocalDateTime(showReleaseTime);
localDateTime = handleHourPastMidnight(showCountry, showNetwork, localDateTime);
localDateTime = handleDstGap(showTimeZone, localDateTime);
// finally get a valid datetime in the show time zone
DateTime dateTime = localDateTime.toDateTime(showTimeZone);
// handle time zone effects on release time for US shows (only if device is set to US zone)
if (deviceTimeZone.startsWith(TIMEZONE_ID_PREFIX_AMERICA)) {
dateTime = applyUnitedStatesCorrections(showCountry, deviceTimeZone, dateTime);
}
return dateTime.getMillis();
}
use of org.joda.time.LocalDate in project killbill by killbill.
the class TestJaxrsBase method beforeMethod.
@BeforeMethod(groups = "slow")
public void beforeMethod() throws Exception {
super.beforeMethod();
// Because we truncate the tables, the database record_id auto_increment will be reset
tenantCacheInvalidation.setLatestRecordIdProcessed(0L);
externalBus.start();
internalBus.start();
cacheControllerDispatcher.clearAll();
busHandler.reset();
clock.resetDeltaFromReality();
clock.setDay(new LocalDate(2012, 8, 25));
// Make sure to re-generate the api key and secret (could be cached by Shiro)
DEFAULT_API_KEY = UUID.randomUUID().toString();
DEFAULT_API_SECRET = UUID.randomUUID().toString();
loginTenant(DEFAULT_API_KEY, DEFAULT_API_SECRET);
// Recreate the tenant (tables have been cleaned-up)
final Tenant tenant = new Tenant();
tenant.setApiKey(DEFAULT_API_KEY);
tenant.setApiSecret(DEFAULT_API_SECRET);
killBillClient.createTenant(tenant, createdBy, reason, comment);
}
Aggregations