use of org.fossasia.openevent.data.extras.EventDates in project open-event-android by fossasia.
the class DateConverter method getDaysInBetween.
@NonNull
public static List<EventDates> getDaysInBetween(@NonNull String startDate, @NonNull String endDate) throws DateTimeParseException {
List<EventDates> dates = new ArrayList<>();
LocalDate start = getDate(startDate).toLocalDate();
LocalDate end = getDate(endDate).toLocalDate();
// add start date
dates.add(new EventDates(DateTimeFormatter.ISO_LOCAL_DATE.format(start)));
// add dates between start date and end date
for (int i = 1; start.plusDays(i).isBefore(end); i++) {
dates.add(new EventDates(DateTimeFormatter.ISO_LOCAL_DATE.format(start.plusDays(i))));
}
// add end date
dates.add(new EventDates(DateTimeFormatter.ISO_LOCAL_DATE.format(end)));
return dates;
}
use of org.fossasia.openevent.data.extras.EventDates in project open-event-android by fossasia.
the class AboutFragmentViewModel method getDateList.
public List<String> getDateList() {
if (dateList == null) {
dateList = new ArrayList<>();
RealmResults<EventDates> eventDates = realmRepo.getEventDatesSync();
for (EventDates eventDate : eventDates) {
dateList.add(eventDate.getDate());
}
}
return dateList;
}
Aggregations