Skip to content
Source
Sign inSign up
TanStack/showcase
A read-only demo of every feature
Every page of this repository is open, and nothing can change. Take a guided tour of what TanStack Source does.

feat: due dates, and lateTasks lists the late tasks #8

OpenAlemTuzlakwants to merge 3 commits intomain fromfeat/due-datesopened

AlemTuzlakcommented

A task can have an optional dueDate (an ISO date). setDueDate sets it, and lateTasks(list, today) lists the open tasks that are late. A task due today is not late.

    1. AlemTuzlak pushedd9c570f

    2. AlemTuzlak pushed5743beb

    3. 2 bot comments
    4. @@ -36,3 +38,9 @@
      3638 export function openTasks(list: TaskList): TaskList {
      3739 return list.filter((task) => !task.done).toSorted((a, b) => a.priority - b.priority)
      3840 }
      41+
      42+/** Gives the task `id` a due date (an ISO date, such as 2026-11-30). */
      43+export function setDueDate(list: TaskList, id: number, dueDate: string): TaskList {
      44+ return list.map((task) => (task.id === id ? { ...task, dueDate } : task))
      45+}
      46+

      Is a plain string compare safe here? It works for ISO dates (2026-11-30), but a date like 2026-1-5 would sort wrong. Maybe check the format in setDueDate.

Sign in to join this conversation.