react-dayjs
React component for the dayjsdayjs date library.Installing
Use npm to installreact-dayjs
as well as its peer dependency, dayjs
.npm install --save dayjs react-dayjs
Then, import the package into your React project:
import React from 'react';
import DayJS from 'react-dayjs';
export default class Application extends React.Component {
...
}
Quick Start
Add theDayJS
component to a component:import React from 'react';
import DayJS from 'react-dayjs';
export default class MyComponent extends React.Component {
render() {
const date = "2000-01-31T12:59-0500";
return (
<DayJS>{ date }</DayJS>
);
}
}
This will output:
<time>2000-01-31T11:59:00-05:00</time>