duckling icon indicating copy to clipboard operation
duckling copied to clipboard

Grain returned on time interval

Open fil090302 opened this issue 6 years ago • 4 comments

When using a message with a time interval like "from 26th oct until 27th oct 3pm", I'm getting the correct times (from '26-10-2018 00:00:00', to '27-10-2018 15:00:00'), but, in my opinion, wrong grain information. Both times are returning grain 'hour', but the 'from' time should be returning 'day' instead, while the 'to' grain is correct as 'hour'. The decision to use the less or more specific grain would then be on the developer using the library.

Is this the intended functionality for any reason?

fil090302 avatar Oct 25 '18 11:10 fil090302

Thanks for the feedback @fil090302. Indeed we're returning the lowest grain for the sake of simplification, as this works for 99% of the use cases.

patapizza avatar Nov 07 '18 05:11 patapizza

Hi @patapizza, I understand that. However, for my use case, it's important to understand how specific the query was on each of the limits. I'll also check the code and try to add this improvement as a PR. Thanks!

fil090302 avatar Nov 07 '18 08:11 fil090302

@fil090302 My use case also requires specific grain information for each of time intervals. Were you able to add improvement? Any other hacks to get to the specifics?

ashokramadass avatar Nov 30 '18 20:11 ashokramadass

@ashokramadass Can't help much.. I was able to avoid the issue for my specific case, but didn't have the time to submit a PR here.

fil090302 avatar Dec 03 '18 17:12 fil090302