Bug in week number function

There is no week 1 !

image
week column is formula weeknum({Date})

And to complete, the “group by week” is working differently than formula week number.
See the 21/02/2021 that is labelled as week 9 in the colum, but grouped with week 8 items

We should have an option for week numbers, as there are multiples case :

  • EU : 1st week with four days
  • USA : week containing January 1st
  • Other : first full week

An option to choose the first day of the week would also be great

EDIT : in addition, it would be GREAT to have to option to not sum the grouped items. i don’t want to sum up week numbers repeated

Hi, if you have looked into the description of the function weeknum() you should have seen this:
image

Apart from that, we also have a full list of all the functions in the SeaTable Manual - Formula Reference:

Write your formula like weeknum('2021-01-03', 'monday') and you’ll get week 1.

And for your second post: the error is caused by the fact that SeaTable takes Sunday as the start of a week automatically when grouping. Users should have the option to choose the starting day of the week. This is surely a thing that should be improved, so thanks for the report!

1 Like

Thanks,
I’ve seen indeed the option of Monday as week 1, but actually, I must cheat to get the good weeknumber in european format on 2021.
I can’t get the ‘first week with 4 days’ by just pointing the starting day of a week.
And even then, there is something wrong, eg with the table.
Formula is weeknum({When},“Monday”)

image

Week 1 lasts only 4 days ?

Hi, no big deal.
Oops, this is a bug, good call!
The first 3 days don’t belong to Week 1 in 2021. I have to report this…

Indeed,
In france, week 1 is from 4th to 10th January

There may be less surprises with a set of ISO 8601 time/date functions. See as well https://en.wikipedia.org/wiki/ISO_week_date for the week-date.

Indeed, at this stage, it seems that the main chronological structure lacks a bit of polish or guideline.

You are absolutely right! SeaTable is only 0.5 years old, there’re surely things that still need polishing. We are polishing already :joy:

And you do it well !
I really appreciate the detailed feedbacks and the way things are going on.

Hi Ben,
could you please check the weeknum function again?
The problem should have been fixed.

My problem is fixed with the new formula isoweeknum (this one works as I needed)

However, the weeknum function is still broken, see the screenshot:

1st left column is the isoweeknum formula
2nd column weeknum
Date is in ISO format
with weeknum, week 52 has 7 days, week 53 has only 5 days and week1 only 2 days…
but isoweek is ok :slight_smile:
best

I am not sure I understand you.

  • isoweeknum: “Returns number of the ISO week number of the year for a given date.”
  • weeknum: “Returns the week number of a specific date, the week containing January 1 is the first week of the year, and is numbered week 1.”

The isoweeknum seems to be doing exactly what it is supposed to do, and so does the weeknum formula. Keep in mind, you can set the return_type in the weeknum function. When set to 1 (default), a new week starts on Sunday; when set to 2, the week starts on Monday.

@Karlheinz Could you add the isoweek function to the “Formelreferenz”?

1 Like

Hi,
thanks for clarification
the weeknum is so far from my use case that i can’t see a reason for this .
but anyway, it’s ok with the isoweeknum so consider as closed :slight_smile:

1 Like

The Formula Reference has been revised now:

1 Like