import { Duration } from 'luxon'; import React from 'react'; const FormatMillisecond = ({ time }: { time: number }) => { const formatTime = Duration.fromMillis(time) .shiftTo('days', 'hours', 'minutes', 'seconds') .toObject(); return (
{formatTime.days !== 0 && {formatTime.days}d } {formatTime.hours !== 0 && {formatTime.hours}h } {formatTime.minutes !== 0 && {formatTime.minutes}m } {formatTime.seconds}s
); }; export default FormatMillisecond;