New year but wrong week number

Can someone explain to me why HA starts the new year with week number 0.
According to all other calendars, the year starts with week number 1.
HA thinks it is now an even week and the calendar says it is an odd week!
Is this a bug or why is it so?
This shows week no 0 this week.

{{ (as_timestamp(now())|timestamp_custom ('%U') | int ) }}

Use %W

For further reference see https://strftime.org/

1 Like

You’ve been ‘caught’ by the fact that 1-Jan falls on a Monday.

%U assumes Sunday as the first day of the week and %W assumes Monday as the first day of the week.

All days before the 1st day are considered to be in week 0, so this week will be 0 for %U but 1 for %W


edit: The international standard assumes Monday is the first day of the week, but there are multiple standards and ~50% of countries do not follow the international standard (US included).

See here:

Monday or Sunday First?

There are at least six different week numbering systems currently in use around the world.

The most common is the International Standard ISO 8601, where Monday is the first day of the week followed by Tuesday, Wednesday, Thursday, Friday, Saturday, and with Sunday as the seventh and final day. Using ISO 8601 can help diminish uncertainty and confusion when communicating internationally.

Not ISO 8601 in US & Canada

About half the world’s population do not follow the ISO standard. Countries like the United States, Canada, Australia, and New Zealand, put Sunday at the start of the week on their calendars.

1 Like

Many thanks for your help, %W solved the problem.