Fix date parsing errors in Backlog view
This commit is contained in:
parent
50164ac95a
commit
33d8822b45
@ -22,7 +22,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Plus, GripVertical, ChevronDown, ChevronRight, Calendar } from "lucide-react"
|
||||
import { format } from "date-fns"
|
||||
import { format, isValid, parseISO } from "date-fns"
|
||||
|
||||
const priorityColors: Record<string, string> = {
|
||||
low: "bg-slate-600",
|
||||
@ -294,10 +294,12 @@ export function BacklogView() {
|
||||
currentSprint
|
||||
? {
|
||||
name: currentSprint.name,
|
||||
date: `${format(new Date(currentSprint.startDate), "MMM d")} - ${format(
|
||||
new Date(currentSprint.endDate),
|
||||
"MMM d"
|
||||
)}`,
|
||||
date: `${(() => {
|
||||
const start = parseISO(currentSprint.startDate)
|
||||
const end = parseISO(currentSprint.endDate)
|
||||
if (!isValid(start) || !isValid(end)) return "Invalid dates"
|
||||
return `${format(start, "MMM d")} - ${format(end, "MMM d")}`
|
||||
})()}`,
|
||||
status: currentSprint.status,
|
||||
}
|
||||
: undefined
|
||||
@ -320,10 +322,12 @@ export function BacklogView() {
|
||||
onTaskClick={(task) => selectTask(task.id)}
|
||||
sprintInfo={{
|
||||
name: sprint.name,
|
||||
date: `${format(new Date(sprint.startDate), "MMM d")} - ${format(
|
||||
new Date(sprint.endDate),
|
||||
"MMM d"
|
||||
)}`,
|
||||
date: (() => {
|
||||
const start = parseISO(sprint.startDate)
|
||||
const end = parseISO(sprint.endDate)
|
||||
if (!isValid(start) || !isValid(end)) return "Invalid dates"
|
||||
return `${format(start, "MMM d")} - ${format(end, "MMM d")}`
|
||||
})(),
|
||||
status: sprint.status,
|
||||
}}
|
||||
/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user