Search in sources :

Example 1 with EventDates

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;
}
Also used : EventDates(org.fossasia.openevent.data.extras.EventDates) ArrayList(java.util.ArrayList) LocalDate(org.threeten.bp.LocalDate) NonNull(android.support.annotation.NonNull)

Example 2 with EventDates

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;
}
Also used : EventDates(org.fossasia.openevent.data.extras.EventDates)

Aggregations

EventDates (org.fossasia.openevent.data.extras.EventDates)2 NonNull (android.support.annotation.NonNull)1 ArrayList (java.util.ArrayList)1 LocalDate (org.threeten.bp.LocalDate)1