Implementation:23blocks OS Ai maestro Task Due
| Knowledge Sources | |
|---|---|
| Domains | Task_Management |
| Last Updated | 2026-10-26 18:00 GMT |
Overview
Concrete tool for parsing and validating card due dates (calendar YYYY-MM-DD, no timezone) and co-owner lists, shared by server and browser, provided by AI Maestro's `lib/task-due.ts`.
Description
The task-due module handles due dates and extra owners for cards. `due` is a calendar date `YYYY-MM-DD` with no time or timezone — a card due "Oct 25" is due Oct 25 wherever it is read. `isValidDue` validates real calendar dates (2026-02-30 is not valid, 2028-02-29 is). `parseDueInput` handles undefined (leave as is), null/empty (clear), or a date string. `owners` are agents that also own a card besides the primary assignee: ids or names, any host, not looked up (most live on other hosts), shown as given. `parseOwnersInput` trims, deduplicates (case-insensitive), removes primary assignees, caps at `MAX_OWNERS` (10). `isCoOwner` checks membership. `dueState`/`dueLabel` compute the display state (overdue, due today, due soon, future).
Usage
Call `parseDueInput(input)` and `parseOwnersInput(input, primaries)` in task create/update. Call `dueLabel`/`dueState` in the UI.
Code Reference
Source Location
- Repository: ai-maestro
- File: lib/task-due.ts
- Lines: L1-L112
Signature
export function isValidDue(value: unknown): value is string
export function parseDueInput(input: unknown): Parsed<string | null | undefined>
export function parseOwnersInput(input: unknown, primaries?: Array<string | null | undefined>): Parsed<string[] | null | undefined>
export function isCoOwner(agentIdOrName: string, owners: string[] | undefined): boolean
export function dueState(due: string | null | undefined, now?: Date): 'overdue' | 'today' | 'soon' | 'future' | 'none'
export function dueLabel(due: string | null | undefined, now?: Date): string
Import
import { parseDueInput, parseOwnersInput, dueLabel, dueState } from '@/lib/task-due'
I/O Contract
| Name | Type | Description |
|---|---|---|
| parseDueInput() returns | Parsed | ok + value or error message |
| dueState() returns | string | 'today' \| 'soon' \| 'future' \| 'none' |
Usage Examples
import { parseDueInput, dueLabel } from '@/lib/task-due'
const due = parseDueInput('2026-10-25')
if (due.ok) saveDue(due.value)
console.log(dueLabel('2026-10-25')) // "Due Oct 25"