duckduckgo / zeroclickinfo-goodies

DuckDuckGo Instant Answers based on Perl & JavaScript
https://duckduckhack.com/
Other
980 stars 1.76k forks source link

DaysBetween should handle ISO8601 date formats! #513

Closed mintsoft closed 10 years ago

mintsoft commented 10 years ago

Like days between 2010-09-17 2014-06-26 ! I believe it only accepts US date format currently (MM/DD/YYYY) I'm not going to suggest trying to deal with DD/MM/YYYY as well, but at least an unambiguous format should work imo! :)

mwmiller commented 10 years ago

As an aside, this is another place where a role or shared library may make sense. I know that "WorkdaysBetween" handles a variety of different date formats (and even tries to disambiguate MM/DD/YYYY from DD/MM/YYYY).

If developers had an opportunity to use the "DDH standard" for recognizing, parsing and displaying different date formats, they would surely jump on it. That would also make things better for users who would be more likely to trigger the relevant IA.

mintsoft commented 10 years ago

@mwmiller Agreed!

moollaza commented 10 years ago

ditto, fwiw if there's any particular helper functions you guys think should be available to all goodies/spice without the need to explicitly use a package, they can always be added into Helper.pm: https://github.com/duckduckgo/duckduckgo/blob/master/lib/DDG/Meta/Helper.pm

p16i commented 10 years ago

Maybe I can look at it since I've worked on DaysBetween's bug.

REF: https://github.com/duckduckgo/zeroclickinfo-goodies/pull/514

jagtalon commented 10 years ago

Agree with the shared libraries! Since we have something like that on the JS side (DDG.capitalize, DDG.isRelevant, etc.) it makes sense to have something for Perl, too.

mintsoft commented 10 years ago

Closed by: https://github.com/duckduckgo/zeroclickinfo-goodies/commit/dcc40ca09b6405d6ce4c467792ddfee12f23ac3f