Fix history label timestamp used in restore file (#22068)

GitOrigin-RevId: 24e3b005664cecc017b610812cb4c666dfb55290
This commit is contained in:
Domagoj Kriskovic 2024-11-27 12:08:16 +01:00 committed by Copybot
parent da411733b6
commit a51126fb06
2 changed files with 4 additions and 13 deletions

View file

@ -1,7 +1,7 @@
import { memo, useCallback } from 'react'
import { UpdateRange, Version } from '../../services/types/update'
import TagTooltip from './tag-tooltip'
import { formatTimeBasedOnYear, isoToUnix } from '../../../utils/format-date'
import { formatTimeBasedOnYear } from '../../../utils/format-date'
import HistoryDropdown from './dropdown/history-dropdown'
import HistoryVersionDetails from './history-version-details'
import { LoadedLabel } from '../../services/types/label'
@ -49,9 +49,9 @@ function LabelListItem({
const { t } = useTranslation()
// first label
const fromVTimestamp = isoToUnix(labels[labels.length - 1].created_at)
const fromVTimestamp = Date.parse(labels[labels.length - 1].created_at)
// most recent label
const toVTimestamp = isoToUnix(labels[0].created_at)
const toVTimestamp = Date.parse(labels[0].created_at)
const updateRange: UpdateRange = {
fromV: version,
@ -92,7 +92,7 @@ function LabelListItem({
version={version}
projectId={projectId}
closeDropdownForItem={closeDropdownForItem}
endTimestamp={toVTimestamp * 1000}
endTimestamp={toVTimestamp}
/>
) : null}
</HistoryDropdown>

View file

@ -26,12 +26,3 @@ export function formatTimeBasedOnYear(date) {
? formatTime(date, 'D MMMM YYYY, h:mm a')
: formatTime(date, 'D MMMM, h:mm a')
}
/**
* @param {string} isoTimestamp
* @returns {number}
*/
export function isoToUnix(isoTimestamp) {
const unixTimestamp = Date.parse(isoTimestamp) / 1000
return unixTimestamp
}