PresearchOfficial/presearch-packages

Provide Client TimeZone as an Input

Opened this issue · 2 comments

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.

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.

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.