neilgupta / Sherlock

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

date ranges to include relative end time... do something on sunday for 4hours #20

Open jayenne opened 7 years ago

jayenne commented 7 years ago

Hi Neil, Would it be trivial to ask for relative end times? Imagine I were to set an event that has a duration rather than fixed end time but it should be completed at some point on a given date. e.g: "Do something on Sunday for 4hours" The 'start' and 'end' would still need to be set for this as well as an additional 'duration'

I guess it would need to include the follow cases:

Do something on Sunday at 6pm for 4hours Do something on Sunday at 6pm for 4hours 30minutes Do something on Sunday at 6pm for 4h 30m Do something on Sunday at 6pm for 4.5h (calculated as a decimal time == 4h 30m)

...However: Do something on Sunday at 6pm for 7:30 would return a 1:30 duration as 7:30 is a recognized 'time' format and not a recognized 'duration' format.

Thanks for listening.