use of java.time.Month in project uhgroupings by uhawaii-system-its-ti-iam.
the class DatesTest method month.
@Test
public void month() {
for (Month month : Month.values()) {
int year = 2012;
LocalDate lastOfMonth = Dates.lastDateOfMonth(month, year);
assertThat(Dates.month(lastOfMonth), is(month));
LocalDate firstOfMonth = Dates.firstDateOfMonth(month, year);
assertThat(Dates.month(firstOfMonth), is(month));
}
}
use of java.time.Month in project tutorials by eugenp.
the class StringConversionUnitTest method whenConvertedToLocalDateTime_thenCorrect.
@Test
public void whenConvertedToLocalDateTime_thenCorrect() {
String str = "2007-12-03T10:15:30";
int afterConvCalendarDay = 03;
Month afterConvCalendarMonth = Month.DECEMBER;
int afterConvCalendarYear = 2007;
LocalDateTime afterConvDate = new UseLocalDateTime().getLocalDateTimeUsingParseMethod(str);
assertEquals(afterConvDate.getDayOfMonth(), afterConvCalendarDay);
assertEquals(afterConvDate.getMonth(), afterConvCalendarMonth);
assertEquals(afterConvDate.getYear(), afterConvCalendarYear);
}
use of java.time.Month in project portfolio by buchen.
the class PerformanceHeatmapWidget method addHeaderRow.
private void addHeaderRow() {
// Top Left is empty
// $NON-NLS-1$
new Cell(table, () -> "");
// no harm in hardcoding the year as each year has the same months
for (LocalDate m = LocalDate.of(2016, 1, 1); m.getYear() == 2016; m = m.plusMonths(1)) {
Month month = m.getMonth();
Cell cell = new Cell(table, () -> {
int numColumns = getDashboardData().getDashboard().getColumns().size();
TextStyle textStyle;
if (numColumns == 1)
textStyle = TextStyle.FULL;
else if (numColumns == 2)
textStyle = TextStyle.SHORT;
else
textStyle = TextStyle.NARROW;
return month.getDisplayName(textStyle, Locale.getDefault());
});
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.FILL).applyTo(cell);
}
}
Aggregations