Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Location Callback Schema example #1000

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wuppious
Copy link

@wuppious wuppious commented Mar 6, 2020

Change timestamp from Date to ISO-8601 UTC string.

Copy link
Member

@christocracy christocracy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is the Javascript schema provided to events (such as onLocation), which is provided a JavaScript Date instance, and the HTTP schema, which is provided the ISO 8601 String. This seems correctly documented to me.

@wuppious
Copy link
Author

wuppious commented Mar 7, 2020

/**
* `ISO-8601 UTC` timestamp provided by the native location API.
*/
timestamp: string;

The interface Location specifies that timestamp property is of type string and is in fact provided an ISO 8601 string in the onLocation listener callback.

@woodybury
Copy link

@christocracy I am also getting string instead of js date from onLocation callback

@chrisdrackett
Copy link

I just came here to open this same PR. If there are two different formats returned by different things maybe this should list both and link them correctly?

@chrisdrackett
Copy link

I'm using this from BackgroundGeolocation.getCurrentPosition fyi, I'm getting an ISO-8601 string for timestamp:

"2021-07-22T22:12:02.393Z"

@christocracy
Copy link
Member

It will remain String.

Create your own new Date(timestamp) instance.

The docs will be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants