duckduckgo / zeroclickinfo-spice

DuckDuckGo Instant Answers based on JavaScript (JSON) APIs
https://duckduckhack.com/
Other
548 stars 942 forks source link

Switch custom date formatting to moment.js #1554

Closed jagtalon closed 7 years ago

jagtalon commented 9 years ago

We recently added support for http://momentjs.com/, and it would be cool if we move things like https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/share/spice/hacker_news/hacker_news.js#L63.

screen shot 2015-02-19 at 1 31 09 pm

If possible, of course. This might be a huge task that needs a bunch of testing so it's best to do one PR for each IA so that it's easier to review.

Usage of moment.js in DuckDuckGo is as follows:

DDG.require("moment.js", function() {
    console.log(moment("9/23/2015").format("dddd, MMMM Do YYYY")); // Wednesday, September 23rd 2015
});
mattr555 commented 9 years ago

YES! gif

There are many "fuzzy date" functions in the codebase that should be replaced. Some more that I found (in no particular order):

russellholt commented 9 years ago

Thanks for looking into that, @mattr555

jagtalon commented 9 years ago

Could also help seatgeek

iambibhas commented 9 years ago

Looks like tvmaze has been moved to moment.js. Should probably update that checklist above.

marianosimone commented 8 years ago

Would be nice to have an updated list of pending IAs that need migration (or close this issue if there are no more ;))

From the current list, both game_info and guidebox seem to have been deleted

MrChrisW commented 8 years ago

@marianosimone Updated the list.

Quick search of the repository https://github.com/duckduckgo/zeroclickinfo-spice/search?utf8=%E2%9C%93&q=getDay the following IA's probably need updating.

moollaza commented 8 years ago

@marianosimone thanks for pointing that out! I've removed GameInfo

@MrChrisW thanks for cleaning up as well!

sekhavati commented 8 years ago

I was going to take a look at the SeatGeek IAs that were highlighted in the search MrChrisW posted above but none of them seem to be working for me. Do they work for anyone else?

I've done a little debugging of the SeatGeek Nearby Concerts IA and it looks to me as though the triggers on the back-end are firing but the JavaScript callback isn't receiving any data.

Client-side I see my browser make a request for _https://duckduckgo.com/js/spice/seat_geek/events_near_me/lat/lon_. If I take this lat/lon pair and manually call the same Seat Geek API endpoint that EventsNearMe.pm does I get many results as expected.

moollaza commented 8 years ago

@sekhavati thanks for reporting this! It looks like they've switched their API to always redirect to HTTPS and so we need to update the Perl to reflect that, for each of the SeatGeek IAs. Would you like to do that?

sekhavati commented 8 years ago

@moollaza Sure, I can take a look. What's the normal protocol, would you like to file an issue first?

moollaza commented 8 years ago

@sekhavati I wouldn't say it's required but if you'd like to, that's perfectly fine.

edgesince84 commented 8 years ago

@jagtalon is this issue still relevant?