overleaf/services/web/frontend/js/features/history/utils/range.ts
Tim Down c870bd5f53 Merge pull request #13104 from overleaf/td-history-compare-to-from
History migration: Add "compare to" and "compare from" options

GitOrigin-RevId: f550ad06b1e812011ecb32e6772354eb0abc2163
2023-05-17 12:04:56 +00:00

19 lines
493 B
TypeScript

import { UpdateRange } from '../services/types/update'
export const updateRangeUnion = (
updateRange1: UpdateRange,
updateRange2: UpdateRange
) => {
return {
fromV: Math.min(updateRange1.fromV, updateRange2.fromV),
toV: Math.max(updateRange1.toV, updateRange2.toV),
fromVTimestamp: Math.min(
updateRange1.fromVTimestamp,
updateRange2.fromVTimestamp
),
toVTimestamp: Math.max(
updateRange1.toVTimestamp,
updateRange2.toVTimestamp
),
}
}