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

isOnlyDate() gives incorrect result when using Monday or some other weekday only #514

Open
Pranoy1c opened this issue Apr 21, 2023 · 2 comments

Comments

@Pranoy1c
Copy link

I would expect the following to give false because there is no date but it gives true instead:

console.log("Result: "+chrono.parse('monday',null,{ forwardDate: true })[0].start?.isOnlyDate())

I think the problem is due to the current implementation of isOnlyDate() which doesn't check if the day, month is isCertain too. Also not sure if year needs to be certain too for it to be a isOnlyDate?:

isOnlyDate() {
        return !this.isCertain("hour") && !this.isCertain("minute") && !this.isCertain("second");
    }
@wanasit
Copy link
Owner

wanasit commented Apr 22, 2023

Hello @Pranoy1c.

The isOnlyDate() has not documented, but my intention was to check if the component describes a date but does not include time, hence "is only date". The implementation follows that meaning exactly.

Could I ask what is the use-case you have in mind for the function?

@Pranoy1c
Copy link
Author

Pranoy1c commented May 27, 2023

@wanasit From what I understand, monday doesn't describe a date, it only specifies a day. It neither has date, nor time.

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