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 { Badge } from "@/components/ui/badge"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Plus, GripVertical, ChevronDown, ChevronRight, Calendar } from "lucide-react"
|
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> = {
|
const priorityColors: Record<string, string> = {
|
||||||
low: "bg-slate-600",
|
low: "bg-slate-600",
|
||||||
@ -294,10 +294,12 @@ export function BacklogView() {
|
|||||||
currentSprint
|
currentSprint
|
||||||
? {
|
? {
|
||||||
name: currentSprint.name,
|
name: currentSprint.name,
|
||||||
date: `${format(new Date(currentSprint.startDate), "MMM d")} - ${format(
|
date: `${(() => {
|
||||||
new Date(currentSprint.endDate),
|
const start = parseISO(currentSprint.startDate)
|
||||||
"MMM d"
|
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,
|
status: currentSprint.status,
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
@ -320,10 +322,12 @@ export function BacklogView() {
|
|||||||
onTaskClick={(task) => selectTask(task.id)}
|
onTaskClick={(task) => selectTask(task.id)}
|
||||||
sprintInfo={{
|
sprintInfo={{
|
||||||
name: sprint.name,
|
name: sprint.name,
|
||||||
date: `${format(new Date(sprint.startDate), "MMM d")} - ${format(
|
date: (() => {
|
||||||
new Date(sprint.endDate),
|
const start = parseISO(sprint.startDate)
|
||||||
"MMM d"
|
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,
|
status: sprint.status,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user