Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Time Zone: Support "Time in <time_zone>" queries #4004

Closed
4 tasks
pjhampton opened this issue Mar 10, 2017 · 11 comments
Closed
4 tasks

Time Zone: Support "Time in <time_zone>" queries #4004

pjhampton opened this issue Mar 10, 2017 · 11 comments

Comments

@pjhampton
Copy link
Contributor

pjhampton commented Mar 10, 2017

Description

Based on user feedback and anonymized search data, DuckDuckGo isn't supporting queries such as "Time in <time_zone>". To further complicate things, the API that we're using for the TimeZone Converter, Location Sunrise/Sunset, and Holiday doesn't support time zone based lookups 😞

screen shot 2017-03-10 at 8 07 20 pm

Solution

There is no perfect solution here, however, the most brainstormed idea could use a hash that maps time zones to countries and uses the time for a given country to show the time for the specified timezone.

https://en.wikipedia.org/wiki/List_of_time_zones_by_country

We could start off with the most popular as a proof of concept, and scale from there. The most popular time zones include:

  • PST
  • CST
  • EST
  • UTC
  • GMT (probably BST too!)

Triggers should include:
time in <time_zone>
Time now <time_zone>
<time_zone> now time

People to notify

@duckduckgo/duckduckhack-contributors

Get Started

Resources


Instant Answer Page: To Be Created 🚀

@BillyBarbaro
Copy link
Collaborator

I've already been looking into this one a little in issue 3181 in the Spice repo. It seems to me like the work on that should cover this issue.

@BillyBarbaro
Copy link
Collaborator

@pjhampton I've got a little bit too much on my plate right now. Could you release this one to the community? I'd be more than happy to talk with whoever takes up the issue about how I was planning to go about things.

@pjhampton
Copy link
Contributor Author

Yeah, of course. Thanks for making me aware @BillyBarbaro!

@shivam99aa
Copy link
Contributor

@pjhampton I can look into this issue. If okay then assign it to me.

@shivam99aa
Copy link
Contributor

shivam99aa commented May 27, 2017

I am done writing the code for this IA which is showing the time in above time zones mentioned. But there is a problem, I am not able to understand how to write a test file for this IA. Since for example a query "time in pst" has no definite answer as it is meant to change every time. Please suggest how I should be writing the test cases for this IA. I am attaching a picture of my local test from codio setup.

img

@shivam99aa
Copy link
Contributor

Also apologies for taking so much time to work on this. I got busy with my regular job.

@shivam99aa
Copy link
Contributor

I went through the documentation and it shows that I might be able to use regex to test for cases where a random answer is generated but after many tries, I am not able to write it properly. Is there any such IA where regex is used in test case file which I can use as reference?

@shivam99aa
Copy link
Contributor

I have one more doubt. So "time in" is already a trigger word for time IA. I am not sure how duckduckgo will behave with same trigger words used in 2 IA.

@shivam99aa
Copy link
Contributor

@pjhampton ^^

@manrajgrover
Copy link
Contributor

I am done writing the code for this IA which is showing the time in above time zones mentioned. But there is a problem, I am not able to understand how to write a test file for this IA. Since for example a query "time in pst" has no definite answer as it is meant to change every time. Please suggest how I should be writing the test cases for this IA. I am attaching a picture of my local test from codio setup.

@shivam99aa For testing, you can mock the time using Test::MockTime and check the output.

I have one more doubt. So "time in" is already a trigger word for time IA. I am not sure how duckduckgo will behave with same trigger words used in 2 IA.

We should check the hash and if remainder is not present in it, we should return giving other IA the opportunity to return result. We should also add the same check in other IA for the same.

@moollaza
Copy link
Member

This is now live

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants