app/react/Layout/PrintDate.js
import PropTypes from 'prop-types';
import React from 'react';
import moment from 'moment';
const PrintDate = ({ utc, toLocal }) => {
let date;
if (!toLocal) {
date = moment.utc(utc).format('ll');
}
if (toLocal) {
date = moment(moment(utc).toDate()).format('ll');
}
return <span>{date}</span>;
};
PrintDate.propTypes = {
utc: PropTypes.number,
toLocal: PropTypes.bool,
};
export default PrintDate;