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

Ignoring leading/trailing whitespace in Parser.parse #88

Closed
h4cc opened this issue Jan 13, 2022 · 2 comments · Fixed by #89
Closed

Ignoring leading/trailing whitespace in Parser.parse #88

h4cc opened this issue Jan 13, 2022 · 2 comments · Fixed by #89
Assignees

Comments

@h4cc
Copy link
Contributor

h4cc commented Jan 13, 2022

When using the ecto type, the user input from a form is directly given to Parser.parse/2 function. The parser does not accept leading/trailing whitespace :(

iex(19)> Crontab.CronExpression.Parser.parse("* * * * *")
{:ok, ~e[* * * * * *]}
iex(20)> Crontab.CronExpression.Parser.parse("* * * * * ")
{:error, "Can't parse  as interval year."}

Is there a way to avoid that?

@maennchen
Copy link
Owner

@h4cc That makes sense. I would like to add a String.trim inside the cast of the Ecto.Type and not in the parser itself.

Would you be willing to open a PR?

@maennchen
Copy link
Owner

Closing in favor of #89

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants