public void setDate1(FieldValue value) { if(value != null) { this.date1 = ((LocalDate) value).atMidnightInMyTimezone(); } }
public void setDate2(FieldValue value) { if(value != null) { this.date2 = ((LocalDate) value).atMidnightInMyTimezone(); } }
public DateRange(org.activityinfo.model.type.time.LocalDate start, org.activityinfo.model.type.time.LocalDate end) { this.start = start.atMidnightInMyTimezone(); this.end = end.atMidnightInMyTimezone(); }
@Override public Collection<Date> toParameters(FieldValue value) { LocalDate dateValue = (LocalDate) value; return singleton(dateValue.atMidnightInMyTimezone()); } }
@Override public void init(FieldValue value) { field.setValue(((LocalDate) value).atMidnightInMyTimezone()); }
public final Double extractDouble(FieldValue value) { if (value instanceof Quantity) { return ((Quantity) value).getValue(); } if (value instanceof LocalDate) { return (double) ((LocalDate) value).atMidnightInMyTimezone().getTime(); } return null; }
public Builder setExpectedPaymentDate(LocalDate date) { return setExpectedPaymentDate(date.atMidnightInMyTimezone()); }
public Builder setExpirationTime(LocalDate date) { return setExpirationTime(date.atMidnightInMyTimezone()); }
@Override public Date render(int rowIndex) { assert view != null : "updateColumnSet() has not been called"; String text = view.getString(rowIndex); if(text == null) { return null; } return LocalDate.parse(text).atMidnightInMyTimezone(); }
@Override public Promise<Void> setValue(LocalDate value) { dateBox.setValue(value.atMidnightInMyTimezone()); return Promise.done(); }
public DayOfWeek getDayOfWeek() { // Use deprecated Date API because it compiles directly to Javascript builtin. //noinspection deprecation return DayOfWeek.values()[atMidnightInMyTimezone().getDay()]; }
@Override public void setValue(Cell cell, int row) { // Excel does not support date values prior to 1900, // so we have no choice but to render the value as text if the date occurs // prior to 1900. LocalDate localDate = renderer.render(row); if(localDate.getYear() < 1900) { cell.setCellValue(localDate.toString()); } else { cell.setCellValue(localDate.atMidnightInMyTimezone()); } } }
@Override public Promise<Void> setValue(LocalDateInterval value) { startDateBox.setValue(value.getStartDate().atMidnightInMyTimezone()); endDateBox.setValue(value.getEndDate().atMidnightInMyTimezone()); return Promise.done(); }
@SuppressWarnings("deprecation") public static LocalDate fromDayOfYear(int year, int dayOfYear) { // Use deprecated Date API because it compiles directly to Javascript builtin. Date jan1 = new LocalDate(year, 1, 1).atMidnightInMyTimezone(); jan1.setDate(dayOfYear); return new LocalDate(jan1); }
@SuppressWarnings("deprecation") public LocalDate plusDays(int count) { // Use deprecated Date API because it compiles directly to Javascript builtin. Date date = atMidnightInMyTimezone(); date.setDate(date.getDate() + count); return new LocalDate(date); }
@Override public void renderTo(FieldValue fieldValue, SafeHtmlBuilder html) { Month month = (Month) fieldValue; html.appendEscaped(I18N.MESSAGES.month(month.getFirstDayOfMonth().atMidnightInMyTimezone())); } }
private FilterConfig dateFilter(FunctionCallNode callNode, LocalDate value) { FilterConfig config = new FilterConfigBean(); config.setType("date"); config.setComparison(parseDateComparison(callNode)); config.setValue("" + value.atMidnightInMyTimezone().getTime()); return config; }
private String expiringIn(AccountStatus status, int year, int month, int day) { return status.expiringIn(new LocalDate(year, month, day).atMidnightInMyTimezone()); }
@Test public void dateComparison() { ColumnFilterParser parser = new ColumnFilterParser(asList(A)); Multimap<Integer, FilterConfig> map = parser.parseFilter(parse("A == DATE(2017, 1, 1)")); Matcher<FilterConfig> equality = Matchers.allOf( hasProperty("type", equalTo("date")), hasProperty("comparison", equalTo("on")), hasProperty("value", equalTo("" + new LocalDate(2017, 1, 1).atMidnightInMyTimezone().getTime()))); assertThat(map.get(0), contains(equality)); }
private void onDatePickerSelected(SelectEvent event) { FieldInput input = input(); if(input.getState() == FieldInput.State.VALID) { PeriodValue value = (PeriodValue) input.getValue(); dateMenu.getDatePicker().setValue(value.asInterval().getStartDate().atMidnightInMyTimezone()); } else { dateMenu.getDatePicker().setValue(new Date()); } dateMenu.show(pickButton); }