fix(date formatting): Show study date as a fallback for an empty series date and show 'No Study Date' as a back up for both (#3483)
This commit is contained in:
parent
fa37593696
commit
15ad8f29cd
@ -1,4 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { utils } from '@ohif/core';
|
import { utils } from '@ohif/core';
|
||||||
import {
|
import {
|
||||||
@ -31,6 +32,8 @@ function PanelStudyBrowserTracking({
|
|||||||
uiNotificationService,
|
uiNotificationService,
|
||||||
} = servicesManager.services;
|
} = servicesManager.services;
|
||||||
|
|
||||||
|
const { t } = useTranslation('Common');
|
||||||
|
|
||||||
// Normally you nest the components so the tree isn't so deep, and the data
|
// Normally you nest the components so the tree isn't so deep, and the data
|
||||||
// doesn't have to have such an intense shape. This works well enough for now.
|
// doesn't have to have such an intense shape. This works well enough for now.
|
||||||
// Tabs --> Studies --> DisplaySets --> Thumbnails
|
// Tabs --> Studies --> DisplaySets --> Thumbnails
|
||||||
@ -134,7 +137,7 @@ function PanelStudyBrowserTracking({
|
|||||||
const actuallyMappedStudies = mappedStudies.map(qidoStudy => {
|
const actuallyMappedStudies = mappedStudies.map(qidoStudy => {
|
||||||
return {
|
return {
|
||||||
studyInstanceUid: qidoStudy.StudyInstanceUID,
|
studyInstanceUid: qidoStudy.StudyInstanceUID,
|
||||||
date: formatDate(qidoStudy.StudyDate),
|
date: formatDate(qidoStudy.StudyDate) || t('NoStudyDate'),
|
||||||
description: qidoStudy.StudyDescription,
|
description: qidoStudy.StudyDescription,
|
||||||
modalities: qidoStudy.ModalitiesInStudy,
|
modalities: qidoStudy.ModalitiesInStudy,
|
||||||
numInstances: qidoStudy.NumInstances,
|
numInstances: qidoStudy.NumInstances,
|
||||||
|
|||||||
@ -22,7 +22,7 @@ function TrackedCornerstoneViewport(props) {
|
|||||||
viewportOptions,
|
viewportOptions,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { t } = useTranslation('TrackedViewport');
|
const { t } = useTranslation('Common');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
measurementService,
|
measurementService,
|
||||||
@ -54,6 +54,7 @@ function TrackedCornerstoneViewport(props) {
|
|||||||
PatientAge,
|
PatientAge,
|
||||||
SliceThickness,
|
SliceThickness,
|
||||||
SpacingBetweenSlices,
|
SpacingBetweenSlices,
|
||||||
|
StudyDate,
|
||||||
ManufacturerModelName,
|
ManufacturerModelName,
|
||||||
} = displaySet.images[0];
|
} = displaySet.images[0];
|
||||||
|
|
||||||
@ -194,7 +195,8 @@ function TrackedCornerstoneViewport(props) {
|
|||||||
getStatusComponent={() => _getStatusComponent(isTracked)}
|
getStatusComponent={() => _getStatusComponent(isTracked)}
|
||||||
studyData={{
|
studyData={{
|
||||||
label: viewportLabel,
|
label: viewportLabel,
|
||||||
studyDate: formatDate(SeriesDate), // TODO: This is series date. Is that ok?
|
studyDate:
|
||||||
|
formatDate(SeriesDate) || formatDate(StudyDate) || t('NoStudyDate'),
|
||||||
currentSeries: SeriesNumber, // TODO - switch entire currentSeries to be UID based or actual position based
|
currentSeries: SeriesNumber, // TODO - switch entire currentSeries to be UID based or actual position based
|
||||||
seriesDescription: SeriesDescription,
|
seriesDescription: SeriesDescription,
|
||||||
patientInformation: {
|
patientInformation: {
|
||||||
|
|||||||
@ -8,5 +8,6 @@ import moment from 'moment';
|
|||||||
* @returns {string} Formatted date
|
* @returns {string} Formatted date
|
||||||
*/
|
*/
|
||||||
export default (date, format = 'DD-MMM-YYYY') => {
|
export default (date, format = 'DD-MMM-YYYY') => {
|
||||||
return moment(date).format(format);
|
// moment(undefined) returns the current date, so return the empty string instead
|
||||||
|
return date ? moment(date).format(format) : '';
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
"Measurements": "Measurements",
|
"Measurements": "Measurements",
|
||||||
"More": "More",
|
"More": "More",
|
||||||
"Next": "Next",
|
"Next": "Next",
|
||||||
|
"NoStudyDate": "No Study Date",
|
||||||
"Play": "Play",
|
"Play": "Play",
|
||||||
"Previous": "Previous",
|
"Previous": "Previous",
|
||||||
"Reset": "Reset",
|
"Reset": "Reset",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user