ham-reserve/next-app/src/components/progress-bar.tsx
Jakob Kordež 21c63f0333 Changes
2023-11-02 15:07:11 +01:00

24 lines
421 B
TypeScript

interface ProgressBarProps {
start: Date;
end: Date;
}
export function ProgressBar({ start, end }: ProgressBarProps) {
const progress = Math.max(
0,
Math.min(
((Date.now() - start.valueOf()) * 100) /
(end.valueOf() - start.valueOf()),
100,
),
).toFixed(1);
return (
<progress
className="progress progress-primary"
value={progress}
max={100}
/>
);
}