react-localized-datetime
v0.0.11
Published
React library exposing components that converts string time to format defined in context
Downloads
37
Maintainers
Readme
react-localized-datetime
Usage
First you need to add language provider somewhere into your project
// App.tsx
import { DateTimeLocalizationProvider } from 'react-localized-datetime';
const App = () => (
<DateTimeLocalizationProvider value="cs-cz">
{/* children */}
</DateTimeLocalizationProvider>
);
and then you just wrap the time string in localization component:
import { LocalizedTime, LocalizedDateTime } from 'react-localized-datetime';
const Record = () => (
<div>
<LocalizedDateTime>2022-08-11 16:20:00</LocalizedDateTime>
<span>{/* text */}</span>
</div>
);