neilgupta / Sherlock

Natural-language event parser for Javascript
https://sherlock.neil.gg
MIT License
538 stars 32 forks source link

Support parsing dates in the past #3

Closed neilgupta closed 10 years ago

neilgupta commented 11 years ago

Currently, Sherlock only allows returned dates to be in the future. That means even if you enter '12/25 at 8pm' and it is past 8pm, Sherlock will return 12/26 at 8pm. The reason for this is that Sherlock was built for homework scheduling, and due dates are always in the future. However, it would be nice to support entering past dates too.

Past date support should be enabled via an optional flag that is passed to Sherlock with each parse, like Sherlock.parse("Homework due yesterday at 3", {enablePast: true}), or via Watson.

This should also support new phrases like "yesterday" or "was 3 days ago."