-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Hi. Thanks for a nice app. You might consider adjusting your code to account for something like this:
remind me to take a nap at 9
Currently the program barfs at:
/usr/local/lib/node_modules/remind-me/lib/parse.js:55
result.time = chrono.parse(result.time)[0].start.date()
TypeError: Cannot read property 'start' of undefined
Adding the following code worked for me (line numbers for your reference):
40
41 if (result.time.length == 1) {
42 result.time = result.time + ':00';
43 }
44 `
That partially worked, but the result can be in the past, which is no good, so I added:
61
62 if (result.time < new Date()) {
63 result.time = new Date(result.time).setMinutes(result.time.getMinutes() + 720); // 12 hours
64 }
65
Then I get what I am looking for:
Ok, I'll remind you to "take a nap" on Tuesday, November 29 at 9:00 pm
Thanks again and I hope this helps you. One more thing: It was easy to convert the command line util into a library that other scripts can call. If you want that code let me know.