I have using ThreeTen in android for displaying 1-week dates from the current date. However, the problem is dates are not displaying in the correct order.
Here's my code for days 1 week dates from the current date:
public List<LocalDate> getWeekDays() {
ZoneId z = ZoneId.of("Pacific/Auckland"); // Or ZoneId.of( "Africa/Tunis" )
LocalDate today = LocalDate.now( z ) ;
LocalDate localDate = today.with( org.threeten.bp.temporal.TemporalAdjusters.previousOrSame( DayOfWeek.SUNDAY ) ) ;
List< LocalDate > dates = new ArrayList<>( 7 ) ;
for( int i = 0 ; i < 7 ; i ++ ) {
localDate = localDate.plusDays( i ) ;
dates.add( localDate ) ;
}
return dates;
}
Here is the picture of displaying dates please check it: