Repository navigation
Sort by date (due date, creation date) #140
Description
Description
Add a sort option to the Upcoming screen that allows users to change the order of tasks within each day group. By default, tasks are sorted by due date, soonest first.
The sort option is presented as a dropdown or pill selector next to the filter dropdowns at the top of the Upcoming screen. Available sort options are:
- Due: Soonest (default) — tasks with the closest due date first
- Due: Latest — tasks with the furthest due date first
- Created: Oldest — tasks created earliest first
- Created: Newest — tasks created most recently first
The selected sort option persists for the session but resets to "Due: Soonest" on app restart.
Depends on #138 (Upcoming screen: day-grouped task list), #139 (Upcoming screen: pill-shaped filter dropdowns).
Scope
In scope: sort option UI (Due: Soonest, Due: Latest, Created: Oldest, Created: Newest), sort logic in UpcomingViewModel, defaulting to Due: Soonest, session-persistent sort selection, and string resources.
Out of scope: sort by priority (separate ticket), sort by proximity (separate ticket #29), sort persistence across app restarts.
Acceptance criteria
- GIVEN the user is on the Upcoming screen
WHEN the screen renders
THEN a sort option selector is shown near the filter dropdowns with options: Due: Soonest, Due: Latest, Created: Oldest, Created: Newest - GIVEN the sort options are displayed
WHEN the screen first loads
THEN "Due: Soonest" is selected by default - GIVEN the user selects "Due: Soonest"
WHEN the selection occurs
THEN tasks within each day group are sorted with the closest due date first - GIVEN the user selects "Due: Latest"
WHEN the selection occurs
THEN tasks within each day group are sorted with the furthest due date first - GIVEN the user selects "Created: Oldest"
WHEN the selection occurs
THEN tasks within each day group are sorted by creation date, oldest first - GIVEN the user selects "Created: Newest"
WHEN the selection occurs
THEN tasks within each day group are sorted by creation date, newest first - GIVEN the user changes the sort option
WHEN the task list updates
THEN the grouping by day is preserved and only the order within groups changes - GIVEN the user has selected a different sort option
WHEN the app is restarted
THEN the sort option resets to "Due: Soonest" - GIVEN user-visible text appears in the sort option selector
WHEN the app renders it
THEN all visible text comes from string resources
Activity