handle safari cocoa core data timestamps (#8440)

This commit is contained in:
Kerry 2022-04-28 18:03:58 +02:00 committed by GitHub
parent c4e988f406
commit de7d5e7c7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,8 +86,13 @@ export const genericPositionFromGeolocation = (geoPosition: GeolocationPosition)
const {
latitude, longitude, altitude, accuracy,
} = geoPosition.coords;
return {
timestamp: geoPosition.timestamp,
// safari reports geolocation timestamps as Apple Cocoa Core Data timestamp
// or ms since 1/1/2001 instead of the regular epoch
// they also use local time, not utc
// to simplify, just use Date.now()
timestamp: Date.now(),
latitude, longitude, altitude, accuracy,
};
};