Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.x isCertain returns unexpected values #555

Closed
surrealroad opened this issue Jun 4, 2024 · 1 comment
Closed

v1.x isCertain returns unexpected values #555

surrealroad opened this issue Jun 4, 2024 · 1 comment

Comments

@surrealroad
Copy link

surrealroad commented Jun 4, 2024

This might just be me misunderstanding what's supposed to happen, but (in the v1 branch):

results = chrono.parse('tomorrow');
results[0].start.isCertain('year') // true
results[0].start.isCertain('month') // true
results[0].start.isCertain('day') // true
results[0].start.isCertain('hour') // false
results[0].start.isCertain('minute') // false
results[0].start.isCertain('second') // false

This works as expected. However:

results = chrono.parse('in 5 minutes');
results[0].start.isCertain('year') // false
results[0].start.isCertain('month') // false
results[0].start.isCertain('day') // false
results[0].start.isCertain('hour') // false
results[0].start.isCertain('minute') // false
results[0].start.isCertain('second') // false

Here I would expect hour/minute/second to be true and the others false.

For now I've written my code to look specifically for isCertain('year') && isCertain('month') && isCertain('day') && !isCertain('hour') && !isCertain('minute') && !isCertain('second') to try to answer the question "can I ignore the time component from this query?", which seems to work.

@wanasit
Copy link
Owner

wanasit commented Aug 10, 2024

I fixed this in b12f412 and published v1.4.9.

However, I noticed there are probably more issues that have already been fixed in v2 and I have less time to keep them both up-to-date. For the longer term, you should update to v2.

@wanasit wanasit closed this as completed Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants