So, like, does :extract day start counting at 1 and end at 0, or does it start counting at 0, but doesn’t start on the same day as week starts? @emmanuel
If it’s supposed to be the day of the week shouldn’t it start on the same day as the week starts?
I have a giant table full of log entries. I want to build timelines by sorting and filtering the log based on different criteria.
One thing I’d particularly like to do is summarize what happened over time periods. Like, instead of just duping every single log into the timeline, take the average of every measurement across a week and present one number for that week.
Ah I see. Interesting. And your problem is that the Sundays are always counted in the previous week. Well it doesn’t look like a problem from January 2nd onwards.
Since Sunday is counted as the last day of the week here, it makes sense that January 1st wouldn’t be the start of week 1. It waited until Monday because it seems like Monday is the first day in the week. And everything looks fine going forward Mondays start the week. Sundays end the week.
HOWEVER, when extracting the day, Sundays count as 0 instead of 7 maybe. That’s all. Doesn’t seem to be a bug.
How is a calendar messing up a day calculation not a bug? The whole point of calendars is to keep track of that kind of thing so we don’t have to second guess it.
1 January can’t possibly be the 52nd week of the year and if the week starts at 0 then 0 should be the first day of the new week.
Something is wrong here because it’s inconsistent with itself.
This is exactly the kind of bug that could have made it into production if I hadn’t decided to experiment with the function before using it. It would have worked most of the time but would have thrown out obscure, inconsistent errors.
I’m only posting it here to see if maybe I was using or interpreting it incorrectly.
It very well could be. All I’m saying is that it’s possible the dates have been constructed in a way where there can’t be a week with less than 7 days. Which is why Sunday, Jan 1st is counted as week 52 of the previous year instead of the start of the current year.
Thanks. This this looks like a great thing to copy & paste into the documentation. You don’t even have to explain how it works because you can just point to the documentation of the library you used. Right now “extract from date” just says that something will happen if you use “extract from date”. The what and why are useful.