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

Provide Client TimeZone as an Input #120

Open
rajagottumukkala opened this issue Feb 17, 2022 · 2 comments
Open

Provide Client TimeZone as an Input #120

rajagottumukkala opened this issue Feb 17, 2022 · 2 comments

Comments

@rajagottumukkala
Copy link

Please pass either full request object or some details about client request to the package.

For example, to write a package that displays current time or converts time from on time zone to another, the package need to know client time zone. Using the time zone of the node that is serving the request will create issues.

To make this more extensible, add parameter of type object along with query and API Key. This will be really helpful to serve result that are location aware.

@treygrainger
Copy link
Member

Thanks for the request @rajagottumukkala. We definitely need some localized date for users available, and will probably want to key this off of whether the user has "local results" enabled or not in their search settings.

Thinking through to other potential search packages, news, sports, weather, and timezone conversion all seem like they could use either city-level location or something a bit less granular (like timezone, which could be derived from the city-level info).

We'll give the API here some thought. Open to your suggestions, as well.

@rajagottumukkala
Copy link
Author

Thanks @treygrainger . Here is some thought.

To maintain backward compatibility, package will still receive query as a separate parameter and another object with remaining request info.

interface RequetInfo{
    country: string; // https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
    state: string;
    language: string; //https://datatracker.ietf.org/doc/html/rfc5646
    timeZone: string; //https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
}

I think this is a good starting point. I dont see a problem in passing this whole object to every package as we are not passing anything that is considered sensitive. If this user did not enable local results, this object will be null.

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