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

Calendar events are not being added if you specify transit #12

Closed
testdruif opened this issue Mar 20, 2020 · 8 comments
Closed

Calendar events are not being added if you specify transit #12

testdruif opened this issue Mar 20, 2020 · 8 comments

Comments

@testdruif
Copy link

Calendar events are not being added because the arrival time passed to the google API is the timestamp in miliseconds. (example: arrival_time=1584806232000)

When doing the request with the epoch timestamp which does not include miliseconds the request succeeds (example: arrival_time=1584806232)

Google dev guide states:

arrival_time — Specifies the desired time of arrival for transit directions, in seconds since midnight, January 1, 1970 UTC. You can specify either departure_time or arrival_time, but not both. Note that arrival_time must be specified as an integer.

I've fixed this by deviding calendar event times by 1000
arrival_time: calendarEvent.startDate/1000

Unclear if it breaks anything else by doing so, will post if so.

@testdruif testdruif changed the title Calendar events are not being added Calendar events are not being added if you specify transit Mar 20, 2020
@testdruif
Copy link
Author

Extra info, it will only fail if you have specified "transit" as one of the options to check.
Car, walking, bike work if call submits arrival time in miliseconds

@testdruif
Copy link
Author

Also added "color: calendarEvent.color" in code because later on it will crash because color wasn't added for these events.

this.config.calendarOptions.map( calOpt => Object.assign({}, calOpt, {
label: calendarEvent.title,
destination: calendarEvent.location,
arrival_time: calendarEvent.startDate/1000,
color: calendarEvent.color
}))

@radokristof
Copy link

Are other options like driving works with the epoch time? If yes I think this is a good workaround.

@testdruif
Copy link
Author

They don't appear to have issues with either the miliseconds or epoch times...
Might be worth looking into

@radokristof
Copy link

I have tried it, it works as it should with your changes also. Basically I don't use alternatives and transit on calendar events (just driving) that's why it didn't happened...

@qistoph
Copy link
Owner

qistoph commented Mar 28, 2020

Thanks for the suggestions. I'm going to add these to the code base and test it for a while.

@qistoph
Copy link
Owner

qistoph commented Mar 28, 2020

I've tested, confirmed and fixed the arrival_time: calendarEvent.startDate/1000.

The color didn't seem to be an issue here. However, since your addition won't do any harm and is actually a nice improvement (matching colors). I'm adding that too.

qistoph added a commit that referenced this issue Mar 28, 2020
@qistoph
Copy link
Owner

qistoph commented Mar 28, 2020

Pushed to branch test. Feel free to try it and provide any feedback here or in a new issue if applicable.

@qistoph qistoph closed this as completed Mar 28, 2020
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

No branches or pull requests

3 participants