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

Chronic not selecting correct 1st monday of the month #400

Open
sidhunavroop opened this issue Jun 8, 2020 · 0 comments
Open

Chronic not selecting correct 1st monday of the month #400

sidhunavroop opened this issue Jun 8, 2020 · 0 comments

Comments

@sidhunavroop
Copy link

sidhunavroop commented Jun 8, 2020

def monday?
      require 'chronic'
      today = Date.today
      1st_monday = Chronic.parse('1st monday of this month', now: today.beginning_of_month).to_date
      3rd_monday = Chronic.parse('3th monday of this month', now: today.beginning_of_month).to_date
      return today == 1st_monday || today == 3rd_monday
end

I have defined this method to select the first or third monday of each month. The issue arose today as Chronic selected June 8th as the first monday of the month which is wrong as June 1st was the first monday. Any idea how this issue can be resolved?
Could it be because we have five mondays this month which confused Chronic?

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