Skip to content

Commit fc7afad

Browse files
Use current year for oldest task date
Replaced the hardcoded year 2024 with the current year using Year.now() when setting the maximum oldest task date. This ensures the logic remains accurate in future years.
1 parent 1a1bbed commit fc7afad

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

app/src/main/java/io/github/secondbrainplanner/TaskViewModel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import androidx.lifecycle.MutableLiveData;
99
import androidx.lifecycle.ViewModel;
1010

11+
import java.time.Year;
1112
import java.util.ArrayList;
1213
import java.util.Calendar;
1314
import java.util.List;
@@ -150,7 +151,7 @@ private List<Object> generateDateList(List<Task> taskList) {
150151
List<Object> itemList = new ArrayList<>();
151152

152153
Calendar calendar = Calendar.getInstance();
153-
calendar.set(2024,1,1); // max oldest task date is 1.1.2024
154+
calendar.set(Year.now().getValue(),1,1); // max oldest task date is 1.1. in same year
154155

155156
Calendar todayCalendar = Calendar.getInstance(); // set calender to start 0:00
156157
todayCalendar.set(Calendar.HOUR_OF_DAY, 0);

0 commit comments

Comments
 (0)