Zeroclickinfo-goodies: Time Zone: Support "Time in <time_zone>" queries

Created on 10 Mar 2017  路  11Comments  路  Source: duckduckgo/zeroclickinfo-goodies

Description

Based on user feedback and anonymized search data, DuckDuckGo isn't supporting queries such as "Time in ". 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 now
now time

People to notify


@duckduckgo/duckduckhack-contributors

Get Started

Resources


Instant Answer Page: To Be Created 馃殌

Highest Impact Tasks High New Instant Answer High Perl Time

Most helpful comment

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

All 11 comments

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.

@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.

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

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

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

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

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?

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.

@pjhampton ^^

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.

This is now live

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nickrsan picture nickrsan  路  29Comments

moollaza picture moollaza  路  12Comments

pjhampton picture pjhampton  路  12Comments

pjhampton picture pjhampton  路  11Comments

gautamkrishnar picture gautamkrishnar  路  16Comments