|
1 | 1 | import { ResourceIcon, ResourceLink } from '@openshift-console/dynamic-plugin-sdk'; |
2 | 2 | import { Button, Tooltip } from '@patternfly/react-core'; |
3 | | -import { FilterIcon, TimesIcon } from '@patternfly/react-icons'; |
| 3 | +import { FilterIcon, GlobeAmericasIcon, TimesIcon } from '@patternfly/react-icons'; |
4 | 4 | import * as React from 'react'; |
5 | 5 | import { useTranslation } from 'react-i18next'; |
6 | 6 | import { FlowDirection, Record } from '../../api/ipfix'; |
7 | 7 | import { Column, ColumnsId, getFullColumnName } from '../../utils/columns'; |
| 8 | +import { dateFormatter, getFormattedDate, timeMSFormatter, utcDateTimeFormatter } from '../../utils/datetime'; |
8 | 9 | import { formatDurationAboveMillisecond } from '../../utils/duration'; |
9 | 10 | import { formatPort } from '../../utils/port'; |
10 | 11 | import { formatProtocol } from '../../utils/protocol'; |
@@ -122,14 +123,27 @@ export const RecordField: React.FC<{ |
122 | 123 | }; |
123 | 124 |
|
124 | 125 | const dateTimeContent = (date: Date | undefined) => { |
125 | | - const dateText = date?.toDateString() || emptyText(); |
126 | | - const timeText = date?.toLocaleTimeString() || emptyText(); |
| 126 | + if (!date) { |
| 127 | + return emptyText(); |
| 128 | + } |
| 129 | + |
| 130 | + const fullDateText = getFormattedDate(date, utcDateTimeFormatter); |
| 131 | + const dateText = getFormattedDate(date, dateFormatter) + ','; |
| 132 | + const timeText = getFormattedDate(date, timeMSFormatter); |
127 | 133 | return singleContainer( |
128 | | - <div data-test={`field-date-${dateText}-${timeText}`}> |
129 | | - <div className={`datetime ${size}`}> |
130 | | - <span>{dateText}</span> <span className="text-muted">{timeText}</span> |
131 | | - </div> |
132 | | - <div className="record-field-tooltip">{`${dateText} ${timeText}`}</div> |
| 134 | + <div data-test={`field-date-${dateText}-${timeText}`} className="record-field-date"> |
| 135 | + <GlobeAmericasIcon className="record-field-date-icon" /> |
| 136 | + <Tooltip |
| 137 | + content={[ |
| 138 | + <span className="co-nowrap" key="co-timestamp"> |
| 139 | + {fullDateText} |
| 140 | + </span> |
| 141 | + ]} |
| 142 | + > |
| 143 | + <div className={`datetime ${size}`}> |
| 144 | + <span>{dateText}</span> <span className="text-muted">{timeText}</span> |
| 145 | + </div> |
| 146 | + </Tooltip> |
133 | 147 | </div> |
134 | 148 | ); |
135 | 149 | }; |
|
0 commit comments