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

Document that getDatetimeIndex() default is *not* UTC #49

Closed
felliott opened this issue May 24, 2016 · 3 comments
Closed

Document that getDatetimeIndex() default is *not* UTC #49

felliott opened this issue May 24, 2016 · 3 comments

Comments

@felliott
Copy link

Hello!

When I started using getDatetimeIndex(), I assumed that it would be returning the time for UTC. I had to read the MDN page for Date() to realize that it was browser-local time. I think it would be handy to document this and perhaps also show how to get the DT in UTC[1]:

var now = new Date(); 
var now_utc = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),  now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
var utcDatetimeIndex = Keen.helpers.getDatetimeIndex(now_utc);

Thank you for your time and effort on this!

Cheers,
Fitz

[1] Adapted from: http://stackoverflow.com/a/6777470

@dustinlarimer
Copy link
Contributor

@felliott that's a great idea! Perhaps that could just be a different/new helper function, like Keen.helpers.getDatetimeIndexUTC()?

@felliott
Copy link
Author

felliott commented Jun 1, 2016

@dustinlarimer That would be awesome! I'm currently tracking both, so having an additional helper would be great.

Cheers,
Fitz

@dustinlarimer
Copy link
Contributor

@felliott thanks again for this comment. I'll roll a note into the README today.

Also, the API now supports this functionality as an add-on! Learn more here: https://keen.io/docs/api/#datetime-parser

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

2 participants