feat(card): show scheduled date range next to dated subtasks
When a subtask has start_date or target_date set, the card detail's checklist row now shows a small '5 Mar → 19 Mar' label next to the title. Mirrors the Gantt's view of the same data without duplicating the chart on the card page. Build clean.
This commit is contained in:
parent
14f6c067c2
commit
cc988c66ca
1 changed files with 36 additions and 0 deletions
|
|
@ -99,6 +99,14 @@ export function SubtaskList({
|
|||
>
|
||||
{subtask.title}
|
||||
</span>
|
||||
{(subtask.start_date || subtask.target_date) && (
|
||||
<span
|
||||
className="shrink-0 text-xs tabular-nums text-text-muted"
|
||||
aria-label={`Scheduled ${subtask.start_date || "?"} to ${subtask.target_date || "?"}`}
|
||||
>
|
||||
{formatRange(subtask.start_date, subtask.target_date)}
|
||||
</span>
|
||||
)}
|
||||
{editable && (
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -136,4 +144,32 @@ export function SubtaskList({
|
|||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
const MONTHS = [
|
||||
"Jan",
|
||||
"Feb",
|
||||
"Mar",
|
||||
"Apr",
|
||||
"May",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Aug",
|
||||
"Sep",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dec",
|
||||
];
|
||||
|
||||
function short(iso: string): string {
|
||||
if (!iso) return "?";
|
||||
const month = Number(iso.slice(5, 7));
|
||||
if (!Number.isFinite(month) || month < 1 || month > 12) return iso;
|
||||
return `${Number(iso.slice(8, 10))} ${MONTHS[month - 1]}`;
|
||||
}
|
||||
|
||||
function formatRange(start: string, end: string): string {
|
||||
if (start && end) return `${short(start)} → ${short(end)}`;
|
||||
if (end) return `by ${short(end)}`;
|
||||
return `from ${short(start)}`;
|
||||
}
|
||||
Loading…
Reference in a new issue