mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 07:39:02 +02:00
Fix history label timestamp used in restore file (#22068)
GitOrigin-RevId: 24e3b005664cecc017b610812cb4c666dfb55290
This commit is contained in:
committed by
Copybot
parent
1fe8ac3be6
commit
a8c9b897f1
+4
-4
@@ -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>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user