snowballtools-base/packages/frontend/src/components/FormatMilliSecond.tsx
Nabarun Gogoi 3c220c5dc6
Implement layout for deploy success page (#9)
Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2023-12-19 15:54:15 +05:30

20 lines
576 B
TypeScript

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 (
<div>
{formatTime.days !== 0 && <span>{formatTime.days}d&nbsp;</span>}
{formatTime.hours !== 0 && <span>{formatTime.hours}h&nbsp;</span>}
{formatTime.minutes !== 0 && <span>{formatTime.minutes}m&nbsp;</span>}
<span>{formatTime.seconds}s</span>
</div>
);
};
export default FormatMillisecond;