The last few days of 2021 logged as 2022 makes sense for payroll, but how the heck is Jan 1st 2022 put in the 2023 year?
The last few days of 2021 logged as 2022 makes sense for payroll, but how the heck is Jan 1st 2022 put in the 2023 year?
First off, I think you have a typo(?) with the "2023"? Because:
* https://www.epochconverter.com/weeks/2022
The reason(s) why the week system was designed:
> * All weeks have exactly 7 days, i.e. there are no fractional weeks.
> * Every week belongs to a single year, i.e. there are no ambiguous or double-assigned weeks.
> * The date directly tells the weekday.
> * All week-numbering years start with a Monday and end with a Sunday.
> * When used by itself without using the concept of month, all week-numbering years are the same except that some years have a week 53 at the end.
* https://en.wikipedia.org/wiki/ISO_week_date#Advantages
This makes perfect sense if your role is in bookkeeping / accounting / finance. Your life is based on pay periods and not on day-of-year/month. A particular pay day "belonging" to a particular year is a meaningless affectation: people need to get paid every two weeks come hell or high water, and anything that can complicate the smooth running of that process is discarded.
As for the algorithm:
> The ISO 8601 definition for week 01 is the week with the first Thursday of the Gregorian year (i.e. of January) in it. The following definitions based on properties of this week are mutually equivalent, since the ISO week starts with Monday: […]
It's not just payrolls, it's also things like deliveries or synchronisation. And saying "monday week 15" (or writing "W15 mon") aside from being short and precise can give a better ground for synchronisation or collision than "April 11th" e.g. the person you're talking to might know that every monday would be an issue and be able to say that that's not an option before even looking it up.
It's not, it's a fiscal, or more generally business creation, allowing businesses to express everything in weekly basis, with no variance (all weeks are 7 days mon-sun with no fractionals, and every week belongs to a single year with no ambiguity).
This is very, very common usage in european businesses, and even casual settings, to the extent that you'll have a hard time finding a physical calendar without weeks printed on it.
This only happened shortly after midnight on January 1st. So I guess this is somehow related to different time zones/offsets.
2022-12-31 23:16:54.013
And then our UI converted this entry into one with 2023
(it correctly assumes that the string is in UTC and then converted it to local time +1h)
A linter should probably flag any format that mixes "week year" with month and days. It's really for use by itself or with payroll week number.
get date as (week year, month, day)
add start_interval to date using regular time handling functions
print "task scheduled to start on: ", date
When you run this code on 31 December 2021 and schedule the task to run 1 day later, you will see 2023 in the logs