diff --git a/src/pages/home/report/ReportActionItemDate.js b/src/pages/home/report/ReportActionItemDate.js deleted file mode 100644 index 58471a88061f..000000000000 --- a/src/pages/home/report/ReportActionItemDate.js +++ /dev/null @@ -1,30 +0,0 @@ -import PropTypes from 'prop-types'; -import React, {memo} from 'react'; -import {withCurrentDate} from '@components/OnyxProvider'; -import Text from '@components/Text'; -import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import compose from '@libs/compose'; - -const propTypes = { - /** UTC timestamp for when the action was created */ - created: PropTypes.string.isRequired, - ...withLocalizePropTypes, -}; - -function ReportActionItemDate(props) { - const styles = useThemeStyles(); - return {props.datetimeToCalendarTime(props.created)}; -} - -ReportActionItemDate.propTypes = propTypes; -ReportActionItemDate.displayName = 'ReportActionItemDate'; - -export default compose( - withLocalize, - - /** This component is hooked to the current date so that relative times can update when necessary - * e.g. past midnight */ - withCurrentDate(), - memo, -)(ReportActionItemDate); diff --git a/src/pages/home/report/ReportActionItemDate.tsx b/src/pages/home/report/ReportActionItemDate.tsx new file mode 100644 index 000000000000..a8c5c208151a --- /dev/null +++ b/src/pages/home/report/ReportActionItemDate.tsx @@ -0,0 +1,31 @@ +import React, {memo} from 'react'; +import {OnyxEntry} from 'react-native-onyx'; +import {withCurrentDate} from '@components/OnyxProvider'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; + +type ReportActionItemDateOnyxProps = { + /** + * UTC timestamp for when the action was created. + * This Onyx prop is hooked to the current date so that relative times can update when necessary + * e.g. past midnight. + */ + // eslint-disable-next-line react/no-unused-prop-types + currentDate: OnyxEntry; +}; + +type ReportActionItemDateProps = ReportActionItemDateOnyxProps & { + created: string; +}; + +function ReportActionItemDate({created}: ReportActionItemDateProps) { + const {datetimeToCalendarTime} = useLocalize(); + const styles = useThemeStyles(); + + return {datetimeToCalendarTime(created, false, false)}; +} + +ReportActionItemDate.displayName = 'ReportActionItemDate'; + +export default memo(withCurrentDate()(ReportActionItemDate));