@kingstinct/react-native-healthkit
Version:
React Native bindings for HealthKit
15 lines (12 loc) • 434 B
text/typescript
import type { EnergyUnit, HKWorkoutRaw, LengthUnit } from '../native-types'
import type { HKWorkout } from '../types'
function deserializeWorkout<TEnergy extends EnergyUnit, TDistance extends LengthUnit>(
sample: HKWorkoutRaw<TEnergy, TDistance>,
): HKWorkout<TEnergy, TDistance> {
return {
...sample,
startDate: new Date(sample.startDate),
endDate: new Date(sample.endDate),
}
}
export default deserializeWorkout