We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
week_start
Hi,
Thanks for all your work on this gem. I've enjoyed using it so far.
I was wondering if there is a way I could have the week_start when grouping by week begin with the first day of the given range?
For example:
relation = Object.where(created_at: 2022-10-15..2022-11-15) relation.group_by_week(:created_at).count
Right now it defaults to Sunday of a week, so the results would be something like:
2022-10-9 => 5, 2022-10-16 => 5, 2022-10-23 => 5, 2022-10-30 => 5 etc.
Would it be possible for the gem to be smart enough and begin on the date I requested?
So ideally:
2022-10-15=>5, 2022-10-22=>5, 2022-10-29=>5, 2022-11-05=>5 etc
Let me know if this is possible right now with the library, I didn't notice this in the documentation or any other issues.
The text was updated successfully, but these errors were encountered:
Hey @wtholt, you can do something like:
range = Date.parse("2022-10-15")..Date.parse("2022-11-15") week_start = range.begin.strftime("%A").downcase.to_sym relation.group_by_week(:created_at, week_start: week_start, range: range).count
Sorry, something went wrong.
That works perfectly! Thank you!
No branches or pull requests
Hi,
Thanks for all your work on this gem. I've enjoyed using it so far.
I was wondering if there is a way I could have the
week_start
when grouping by week begin with the first day of the given range?For example:
Right now it defaults to Sunday of a week, so the results would be something like:
Would it be possible for the gem to be smart enough and begin on the date I requested?
So ideally:
Let me know if this is possible right now with the library, I didn't notice this in the documentation or any other issues.
The text was updated successfully, but these errors were encountered: