Skip to content

Fix Location Callback Schema example#1000

Closed
wuppious wants to merge 1 commit intotransistorsoft:masterfrom
wuppious:patch-1
Closed

Fix Location Callback Schema example#1000
wuppious wants to merge 1 commit intotransistorsoft:masterfrom
wuppious:patch-1

Conversation

@wuppious
Copy link
Copy Markdown

@wuppious wuppious commented Mar 6, 2020

Change timestamp from Date to ISO-8601 UTC string.

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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

@chrisdrackett
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
Member

It will remain String.

Create your own new Date(timestamp) instance.

The docs will be updated.

@wuppious
Copy link
Copy Markdown
Author

Any plans on updating the docs then now that this is closed? :-)

* "timestamp": [Date], // <-- Javascript Date instance

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.

4 participants