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

having a dash "-" in the input with no date returns a daily occurrence beginning w/ the current day #7

Open
codeodor opened this issue Apr 28, 2011 · 2 comments

Comments

@codeodor
Copy link

Example:

Nickel.parse "job search - apply at virgin intergalactic"

Returns:

message: "job search apply at virgin intergalactic", occurrences: [#<Occurrence type: daily, start_date: "20110428", interval: 1>] 

I would expect without any date information, it should return an empty array for occurrences.

Additionally, Nickel.parse "-" by itself results in NoMethodError: undefined method `interpret_date' for nil:NilClass

@codeodor
Copy link
Author

What's happening is that the query_formatting method is replacing "-" with "through", regardless of any other date information. Then the query_pre_processing method changes that to "today through" which is where it picks up the date.

So that means anything with "through" in it also gets turned into a date, even if it shouldn't. For example: "go through all tests and correct them" also gets an occurrence set for daily starting with the current date.

@codeodor
Copy link
Author

I wrote a couple of tests for this. I'm interested in fixing it, and my thought was to do something like this:

replace_hyphens if date_info_present? 
...
nsub!(/^(through|until)/,'today through') if date_info_present?

I haven't read through all the code yet, so before I go writing a new method to take care of it, is there anything like that already written that I could take advantage of (or parts that could be assembled together to create it)?

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

1 participant