You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is 3:25pm where I live, and if I do r at 4:30 Go home it sets a reminder at 4:30am tomorrow morning. The date parsing library is interpreting it correctly, albeit a bit too literal. I have to do r at 16:30 or r at 4:30 tonight to get it to work as intended. The same thing happens if I do r at 3:45 - even though that is in 20 minutes, it interprets it as tomorrow morning at 3:45am.
It would be helpful to add some logic that determines the nearest future hour instead of parsing it literally. I think the conditions would be:
It is currently PM
No AM/PM is specified in the command
The provided hour is between 0 and 12
The provided hour is >= the current hour
The Chrono docs actually has a code snippet in the "Refiner" section that does something very similar:
// In the example, the custom refiner assigns PM to parsing results with ambiguous meridiem (http://en.wikipedia.org/wiki/12-hour_clock).constcustom=chrono.casual.clone();custom.refiners.push({refine: (context,results)=>{// If there is no AM/PM (meridiem) specified,// let all time between 1:00 - 4:00 be PM (13.00 - 16.00)results.forEach((result)=>{if(!result.start.isCertain('meridiem')&&result.start.get('hour')>=1&&result.start.get('hour')<4){result.start.assign('meridiem',1);result.start.assign('hour',result.start.get('hour')+12);}});returnresults;}});// This will be parsed as PM.// > Tue Dec 16 2014 14:30:00 GMT-0600 (CST) custom.parseDate("This is at 2.30");// Unless the 'AM' part is specified// > Tue Dec 16 2014 02:30:00 GMT-0600 (CST)custom.parseDate("This is at 2.30 AM");
With a little bit of tweaking, I think that could do exactly what I'm talking about. If you'd like, I'd be happy to PR the change. It will likely be a couple of weeks from now, but I'd be happy to.
Thanks for such an amazing workflow! It's indispensable to my daily routine.
The text was updated successfully, but these errors were encountered:
It is 3:25pm where I live, and if I do
r at 4:30 Go home
it sets a reminder at 4:30am tomorrow morning. The date parsing library is interpreting it correctly, albeit a bit too literal. I have to dor at 16:30
orr at 4:30 tonight
to get it to work as intended. The same thing happens if I dor at 3:45
- even though that is in 20 minutes, it interprets it as tomorrow morning at 3:45am.It would be helpful to add some logic that determines the nearest future hour instead of parsing it literally. I think the conditions would be:
0
and12
>=
the current hourThe Chrono docs actually has a code snippet in the "Refiner" section that does something very similar:
https://github.com/wanasit/chrono/blob/b6140ec17996fec84c790891ecbfd8b7d44fbb5b/README.md#L218-L245
With a little bit of tweaking, I think that could do exactly what I'm talking about. If you'd like, I'd be happy to PR the change. It will likely be a couple of weeks from now, but I'd be happy to.
Thanks for such an amazing workflow! It's indispensable to my daily routine.
The text was updated successfully, but these errors were encountered: