count due days by calendar day, not elapsed hours
a date two hours in the past read as due soon, and DST days were a day out
This commit is contained in:
@@ -3,7 +3,7 @@ import { createPortal } from "react-dom";
|
||||
import { format } from "date-fns";
|
||||
import { motion, useReducedMotion, AnimatePresence } from "framer-motion";
|
||||
import { fadeSlideUp, springs } from "@/lib/motion";
|
||||
import { parseDueDate } from "@/lib/due-date";
|
||||
import { dueDaysFromToday, parseDueDate } from "@/lib/due-date";
|
||||
import { useSortable } from "@dnd-kit/sortable";
|
||||
import { CSS } from "@dnd-kit/utilities";
|
||||
import type { Card, Label, Priority } from "@/types/board";
|
||||
@@ -27,11 +27,9 @@ import { useBoardStore } from "@/stores/board-store";
|
||||
|
||||
function getDueDateStatus(dueDate: string | null): { color: string; bgColor: string; label: string } | null {
|
||||
if (!dueDate) return null;
|
||||
const dueDay = parseDueDate(dueDate);
|
||||
if (!dueDay) return null;
|
||||
const now = new Date();
|
||||
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
const diffDays = Math.ceil((dueDay.getTime() - today.getTime()) / (1000 * 60 * 60 * 24));
|
||||
const due = parseDueDate(dueDate);
|
||||
if (!due) return null;
|
||||
const diffDays = dueDaysFromToday(due);
|
||||
|
||||
if (diffDays < 0) {
|
||||
return { color: "text-pylon-danger", bgColor: "bg-pylon-danger/10", label: "Overdue" };
|
||||
|
||||
Reference in New Issue
Block a user