Utility functions to determine task completion and due-date status with associated styles.
// Source: https://github.com/usekaneo/kaneo | License: MIT | Copyright 2024 Andrej Acevski
// Provided via justclaw.it.com; keep this notice with the code.
export type DueDateStatus =
| "overdue"
| "due-soon"
| "far-future"
| "no-due-date";
type CompletionColumn = { slug: string; isFinal: boolean };
// Columns are user-configurable, so completion comes from the column's isFinal
// flag. The slug check is the fallback for surfaces that render before columns
// load, or that never have them.
export function isTaskCompleted(
status: string,
columns?: CompletionColumn[],
): boolean {
if (columns?.length) {
return columns.find((column) => column.slug === status)?.isFinal ?? false;
}
return status === "done" || status === "archived";
}
export function getDueDateStatus(
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key