Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS Migration] Migrate ReportActionItemDate.js to TypeScript #32675

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions src/pages/home/report/ReportActionItemDate.js

This file was deleted.

31 changes: 31 additions & 0 deletions src/pages/home/report/ReportActionItemDate.tsx
Original file line number Diff line number Diff line change
@@ -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<string>;
JKobrynski marked this conversation as resolved.
Show resolved Hide resolved
};

type ReportActionItemDateProps = ReportActionItemDateOnyxProps & {
created: string;
};

function ReportActionItemDate({created}: ReportActionItemDateProps) {
const {datetimeToCalendarTime} = useLocalize();
const styles = useThemeStyles();

return <Text style={[styles.chatItemMessageHeaderTimestamp]}>{datetimeToCalendarTime(created, false, false)}</Text>;
}

ReportActionItemDate.displayName = 'ReportActionItemDate';

export default memo(withCurrentDate()(ReportActionItemDate));
Loading