neilgupta / Sherlock

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

time system for 24-hour clock as a options #31

Closed roeniss closed 1 year ago

roeniss commented 4 years ago

when I typed above, the result was "2020-08-24T23:00:00 ~ 2020-08-25T00:00:00", rather than "2020-08-24T11:00:00 ~ 2020-08-25T12:00:00" which I thought it would.

can we change this stuff? I think 24-hour time system is more intuitive than 11am or full qualified timestamp (ex, 2020-08-24T11:00:00)

(actually this idea came from here : https://github.com/toniov/gcal-cli/issues/15)

neilgupta commented 4 years ago

Hi @roeniss, that's a good point! This is a tough one. Sherlock does support 24-hour time when it's not ambiguous. For example interview Mon 14:00 works as expected. However, when there's ambiguity, Sherlock tries to guess what you mean based on the current time. For example, if you typed interview Mon 11:00 at 9am, you would actually get the response you're hoping for. However, if you type it in the afternoon, Sherlock assumes PM since that's the more upcoming time.

Obviously that heuristic isn't fool proof. I'd be open to a pull request that adds an option for weighting 24 hour time over the current logic when dealing with ambiguity, but I don't want to change the default behavior here. gcal would have to add support for the option too somehow.