use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class EventDatePickerDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View view = LayoutInflater.from(getThemedContext()).inflate(R.layout.dialog_birthday_picker, null, false);
datePicker = Views.findById(view, R.id.dialog_birthday_picker);
final EventType eventType = getEventType();
if (initialDate.isPresent()) {
datePicker.setDisplayingDate(initialDate.get());
}
return new AlertDialog.Builder(getActivity()).setTitle(eventType.getEventName(strings)).setView(view).setPositiveButton(R.string.birthday_picker_dialog_positive, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Date date = datePicker.getDisplayingDate();
listener.onDatePicked(eventType, date);
}
}).create();
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class DateTest method whenAddingADayOfMonth_thenIncreaseNormally.
@Test
public void whenAddingADayOfMonth_thenIncreaseNormally() {
Date after = ANY_DATE.addDay(1);
int expectedDay = DAY + 1;
assertThat(after.getDayOfMonth()).isEqualTo(expectedDay);
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class DateTest method testOneYearAhead.
@Test
public void testOneYearAhead() {
Date firstDayOfYear = Date.Companion.on(1, JANUARY, 1990);
Date secondDayOfYear = Date.Companion.on(1, JANUARY, 1991);
assertThat(firstDayOfYear.daysDifferenceTo(secondDayOfYear)).isEqualTo(365);
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class DateTest method givenDateWithShortMonthAndCommonYear_thenReturn28Days.
@Test
public void givenDateWithShortMonthAndCommonYear_thenReturn28Days() {
Date date = Date.Companion.on(1, FEBRUARY, 2018);
assertThat(date.getDaysInCurrentMonth()).isEqualTo(28);
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class DateTest method testTwoYearAhead.
@Test
public void testTwoYearAhead() {
Date firstDayOfYear = Date.Companion.on(1, JANUARY, 1990);
Date secondDayOfYear = Date.Companion.on(1, JANUARY, 1992);
assertThat(firstDayOfYear.daysDifferenceTo(secondDayOfYear)).isEqualTo(365 * 2);
}
Aggregations