* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { useIntl } from 'react-intl';
import BranchStatus from '../../../../components/common/BranchStatus';
import HomePageSelect from '../../../../components/controls/HomePageSelect';
import DetachIcon from '../../../../components/icons/DetachIcon';
-import DateTimeFormatter from '../../../../components/intl/DateTimeFormatter';
+import { formatterOption } from '../../../../components/intl/DateTimeFormatter';
import { isBranch, isPullRequest } from '../../../../helpers/branch-like';
-import { translate } from '../../../../helpers/l10n';
+import { translate, translateWithParameters } from '../../../../helpers/l10n';
import { BranchLike } from '../../../../types/branch-like';
import { ComponentQualifier } from '../../../../types/component';
import { TaskWarning } from '../../../../types/tasks';
const currentPage = getCurrentPage(component, branchLike);
const displayVersion = component.version !== undefined && isABranch;
+ const lastAnalysisDate = useIntl().formatDate(component.analysisDate, formatterOption);
return (
<>
</span>
)}
{component.analysisDate && (
- <span className="spacer-left nowrap note">
- <DateTimeFormatter date={component.analysisDate} />
+ <span
+ title={translateWithParameters(
+ 'overview.project.last_analysis.date_time',
+ lastAnalysisDate
+ )}
+ className="spacer-left nowrap note">
+ {lastAnalysisDate}
</span>
)}
{displayVersion && (
import { ComponentQualifier } from '../../../../../types/component';
import { getCurrentPage, HeaderMeta, HeaderMetaProps } from '../HeaderMeta';
+jest.mock('react-intl', () => ({
+ useIntl: jest.fn().mockImplementation(() => ({
+ formatDate: jest.fn().mockImplementation(() => '2017-01-02T00:00:00.000Z')
+ }))
+}));
+
it('should render correctly for a branch', () => {
const wrapper = shallowRender();
expect(wrapper).toMatchSnapshot();
</span>
<span
className="spacer-left nowrap note"
+ title="overview.project.last_analysis.date_time.2017-01-02T00:00:00.000Z"
>
- <DateTimeFormatter
- date="2017-01-02T00:00:00.000Z"
- />
+ 2017-01-02T00:00:00.000Z
</span>
<span
className="spacer-left nowrap note"
</span>
<span
className="spacer-left nowrap note"
+ title="overview.project.last_analysis.date_time.2017-01-02T00:00:00.000Z"
>
- <DateTimeFormatter
- date="2017-01-02T00:00:00.000Z"
- />
+ 2017-01-02T00:00:00.000Z
</span>
<span
className="spacer-left nowrap note"
</span>
<span
className="spacer-left nowrap note"
+ title="overview.project.last_analysis.date_time.2017-01-02T00:00:00.000Z"
>
- <DateTimeFormatter
- date="2017-01-02T00:00:00.000Z"
- />
+ 2017-01-02T00:00:00.000Z
</span>
</div>
<div
overview.project.main_branch_no_lines_of_code=The main branch has no lines of code.
overview.project.main_branch_empty=The main branch of this project is empty.
overview.project.branch_needs_new_analysis=The branch data is incomplete. Run a new analysis to update it.
+overview.project.last_analysis.date_time=Last analysis started on {0}
overview.project.next_steps.set_up_pr_deco_and_ci.admin=To benefit from more of SonarQube's features, {link_ci} and set up DevOps platform integration in your {link_project_settings}.
overview.project.next_steps.set_up_pr_deco_and_ci=To benefit from more of SonarQube's features, {link_ci} and ask a project administrator to set up DevOps platform integration.
overview.project.next_steps.set_up_pr_deco.admin=To benefit from more of SonarQube's features, set up DevOps platform integration in your {link_project_settings}.