How are MySQL dates queried for "this week" and "last week"?

I am noticing some discrepancies in the counts for records queried by week in MySQL. Does Metabase use YEARWEEK() in the queries and if so, do weeks begin on Sunday or Monday? I’m guessing since our application considers weeks to start on Monday, this may be the difference.

Thank you

Theres a timezone bug we’re working on - https://github.com/metabase/metabase/issues/1635

Otherwise yes, I’m pretty sure we’re using Sunday starts. Is this something you’d need to change?

I’ve confirmed that my metrics match if I use Sunday for the start of the week. It would be helpful if we could change this. For my company, we chart metrics starting Monday (the work week). For our queries we use “mode = 1” for mysql WEEK():

https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_week

Opened an issue at https://github.com/metabase/metabase/issues/1779

I have started work on this and you can see the screenshots and a PR linked to the issue posted by sameer.
Here’s a direct link to the comment where I post the screenshots: https://github.com/metabase/metabase/issues/1779#issuecomment-301482150 .

I would like the community’s help on getting this right and reviewed as I’m unfamiliar with Clojure and not a web dev. I work as a Data Engineer and am happy to do deployments and data quality and SQL stuff.