Add files via upload
This commit is contained in:
6
frontend/src/utils/dateHelpers.js
Normal file
6
frontend/src/utils/dateHelpers.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import { format, isBefore, isToday, parseISO } from 'date-fns'
|
||||
|
||||
export const formatDate = (s) => s ? format(parseISO(s), 'MMM d, yyyy') : ''
|
||||
export const formatDateForInput = (s) => s ? s.substring(0, 10) : ''
|
||||
export const isOverdue = (s) => s && isBefore(parseISO(s), new Date()) && !isToday(parseISO(s))
|
||||
export const isDueToday = (s) => s && isToday(parseISO(s))
|
||||
15
frontend/src/utils/statusHelpers.js
Normal file
15
frontend/src/utils/statusHelpers.js
Normal file
@@ -0,0 +1,15 @@
|
||||
export const STATUS_OPTIONS = [
|
||||
{ value: 'upcoming', label: 'Upcoming' },
|
||||
{ value: 'in_progress', label: 'In Progress' },
|
||||
{ value: 'completed', label: 'Completed' },
|
||||
{ value: 'overdue', label: 'Overdue' },
|
||||
]
|
||||
|
||||
export const STATUS_COLORS = {
|
||||
upcoming: { bg: 'bg-blue-500/20', text: 'text-blue-400', border: 'border-blue-500/30' },
|
||||
in_progress: { bg: 'bg-amber-500/20', text: 'text-amber-400', border: 'border-amber-500/30' },
|
||||
completed: { bg: 'bg-green-500/20', text: 'text-green-400', border: 'border-green-500/30' },
|
||||
overdue: { bg: 'bg-red-500/20', text: 'text-red-400', border: 'border-red-500/30' },
|
||||
}
|
||||
|
||||
export const getStatusLabel = (s) => STATUS_OPTIONS.find(o => o.value === s)?.label || s
|
||||
Reference in New Issue
Block a user