Use Moment-Timezone for Time (and other related) Spices #2567
Comments
@MrChrisW is the maintainer for time. |
I believe @MrChrisW and I spoke somewhere about this on GitHub, I don't recall if any decisions were made. It seems like it could potentially replace several Time-related Spice/Goodies. I'm a little concerned with the size of the lib though -- how much would this increase the payload on the page? |
@altern8tif Can we clarify the suggestion of replacing the Time IA with moment timezone. Do you mean instead of requesting a specific location from the TimeAndData API we only pull the current UTC time and use moment timezone to convert to the relevant zone based on the user query? |
@MrChrisW yup... Seeing as we already have the timezone information in Not sure if there are any benefits from turning it into a Goodie vs a Spice? Or maybe it's a case of "if it ain't broke, don't fix it"? I think the more immediate benefit would be as per the discussion in #1802... |
What's specially interesting about moment's timezone is that it keeps track of DST shifts, which are usually a pain to handle. Regarding @moollaza's concern about the size, we could consider what amount of the data they offer we really need (maybe in a IA by IA basis), as it seems like they do provide a subset, so we could create our own (for example, some IAs only need the information for the current year... Or even more, just for the current moment!) |
If we do move away from using an API for Time (which I personally think would be best - it is a very simple task we could handle without the dependency) we should move it over to Goodies. We don't even need to use I think the best approach would be |
@altern8tif we're not only showing results for the locations in Capitals.yml though -- we also use a Deep trigger to get results for other locations like https://duckduckgo.com/?q=time+in+marseille+france&ia=time AFAIK there's no easy way for us to do that without an API. A pure Perl route would require a DB of all places + logic to figure out the best candidate for a search query -- too much effort required when we have a free API available to us. |
@moollaza True, I keep thinking we have a Perl package for looking up countries! Lets hope the CLDR builds a map of geographical locations! |
I was browsing through momentjs-timezone recently and thought that it might actually be possible to replace the Time Spice.
Not to mention, it could also address other IAs such as #2508, #2545, #2156, #1802 or where timezones or daylight savings were not previously considered.
Any thoughts?
IA Page: https://duck.co/ia/view/time
The text was updated successfully, but these errors were encountered: