ghost-portal/packages/page-calendar/src/DayTime.tsx
Tarik Gul 384049fb6b
2025 (#11172)
* 2025

* update ci scripts to add access to scripts
2025-01-03 03:59:53 +02:00

21 lines
542 B
TypeScript

// Copyright 2017-2025 @polkadot/app-calendar authors & contributors
// SPDX-License-Identifier: Apache-2.0
import React, { useEffect, useState } from 'react';
function DayTime (): React.ReactElement {
const [now, setNow] = useState(new Date());
useEffect((): () => void => {
const intervalId = setInterval(() => setNow(new Date()), 1000);
return (): void => {
clearInterval(intervalId);
};
}, []);
return <>{now.toLocaleTimeString().split(':').slice(0, 2).join(':')}</>;
}
export default React.memo(DayTime);