UNPKG

@kingstinct/react-native-healthkit

Version:
18 lines (15 loc) 537 B
import type { HKQuantitySampleRaw, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types' import type { HKQuantitySample } from '../types' function deserializeQuantitySample< TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier> >( sample: HKQuantitySampleRaw<TIdentifier, TUnit>, ): HKQuantitySample<TIdentifier, TUnit> { return { ...sample, startDate: new Date(sample.startDate), endDate: new Date(sample.endDate), } } export default deserializeQuantitySample