{"action":"created","issue":{"url":"https://api.github.com/repos/mojombo/chronic/issues/303","labels_url":"https://api.github.com/repos/mojombo/chronic/issues/303/labels{/name}","comments_url":"https://api.github.com/repos/mojombo/chronic/issues/303/comments","events_url":"https://api.github.com/repos/mojombo/chronic/issues/303/events","html_url":"https://github.com/mojombo/chronic/issues/303","id":73479705,"number":303,"title":"Mother's day parsing (calling 'next' may when current month is May)","user":{"login":"RustComet","id":4001414,"avatar_url":"https://avatars.githubusercontent.com/u/4001414?v=3","gravatar_id":"","url":"https://api.github.com/users/RustComet","html_url":"https://github.com/RustComet","followers_url":"https://api.github.com/users/RustComet/followers","following_url":"https://api.github.com/users/RustComet/following{/other_user}","gists_url":"https://api.github.com/users/RustComet/gists{/gist_id}","starred_url":"https://api.github.com/users/RustComet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RustComet/subscriptions","organizations_url":"https://api.github.com/users/RustComet/orgs","repos_url":"https://api.github.com/users/RustComet/repos","events_url":"https://api.github.com/users/RustComet/events{/privacy}","received_events_url":"https://api.github.com/users/RustComet/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mojombo/chronic/labels/bug","name":"bug","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-06T01:12:09Z","updated_at":"2015-05-06T19:25:48Z","closed_at":null,"body":"So I have a method that I was using to calculate Mother's day. And it was working fine until we ticked over to the month of May.\r\n\r\nCalling `this May` works fine now:\r\n```\r\n2.1.2 :023 > Time.now\r\n => 2015-05-06 11:08:30 +1000 \r\n2.1.2 :024 > Chronic.parse(\"2nd Sunday this May\")\r\n => 2015-05-10 12:00:00 +1000 \r\n```\r\n\r\nBut something strange happens when I ask for the `2nd Sunday of next May`\r\n\r\n```\r\n2.1.2 :025 > Chronic.parse(\"2nd Sunday of next May\")\r\nRuntimeError: Current month should be set by now\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_month_name.rb:48:in `next'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/chronic-0.10.2/lib/chronic/handlers.rb:529:in `get_anchor'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/chronic-0.10.2/lib/chronic/handlers.rb:489:in `handle_o_r_g_r'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/chronic-0.10.2/lib/chronic/handler.rb:76:in `invoke'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/chronic-0.10.2/lib/chronic/parser.rb:260:in `block in tokens_to_span'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/chronic-0.10.2/lib/chronic/parser.rb:258:in `each'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/chronic-0.10.2/lib/chronic/parser.rb:258:in `tokens_to_span'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/chronic-0.10.2/lib/chronic/parser.rb:61:in `parse'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/chronic-0.10.2/lib/chronic.rb:90:in `parse'\r\n\tfrom (irb):25\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/console.rb:90:in `start'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/console.rb:9:in `start'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:69:in `console'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:in `run_command!'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands.rb:17:in `<top (required)>'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/skylight-0.3.20/lib/skylight/probes.rb:81:in `require'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/skylight-0.3.20/lib/skylight/probes.rb:81:in `require'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `block in require'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'\r\n\tfrom /Users/Fabs/Desktop/Work/HappyWifeBackend/bin/rails:8:in `<top (required)>'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `load'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `block in load'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'\r\n\tfrom /Users/Fabs/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `load'\r\n\tfrom /Users/Fabs/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'\r\n\tfrom /Users/Fabs/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'\r\n```\r\n\r\nI could understand if it returned May 2016, but it's not setting the month at all.\r\n\r\nHad a look through the source and I am not sure how this is happening… looks a little out of my league though, so not sure if I could contribute a bugfix."},"comment":{"url":"https://api.github.com/repos/mojombo/chronic/issues/comments/99580259","html_url":"https://github.com/mojombo/chronic/issues/303#issuecomment-99580259","issue_url":"https://api.github.com/repos/mojombo/chronic/issues/303","id":99580259,"user":{"login":"davispuh","id":651800,"avatar_url":"https://avatars.githubusercontent.com/u/651800?v=3","gravatar_id":"","url":"https://api.github.com/users/davispuh","html_url":"https://github.com/davispuh","followers_url":"https://api.github.com/users/davispuh/followers","following_url":"https://api.github.com/users/davispuh/following{/other_user}","gists_url":"https://api.github.com/users/davispuh/gists{/gist_id}","starred_url":"https://api.github.com/users/davispuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davispuh/subscriptions","organizations_url":"https://api.github.com/users/davispuh/orgs","repos_url":"https://api.github.com/users/davispuh/repos","events_url":"https://api.github.com/users/davispuh/events{/privacy}","received_events_url":"https://api.github.com/users/davispuh/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T19:25:48Z","updated_at":"2015-05-06T19:25:48Z","body":"Don't worry about fixing, there's ongoing rewrite of large part of Chronic and I know how big mess current code is. Also actually this is fixed in my rewrite branch\r\n\r\n```ruby\r\nChronic.parse(\"2nd Sunday of next May\", :guess => false)\r\n=> 2016-05-08 00:00:00 +0300...2016-05-09 00:00:00 +0300\r\n```\r\n\r\nBut that rewrite isn't finished and I'll have time to continue work on it only in autumn. So for now you'll have to somehow workaround it yourself.\r\n\r\n"}}