teable icon indicating copy to clipboard operation
teable copied to clipboard

Add "first day of week" select to My Settings tab

Open InsaneCake opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. In date picker for date/time field first day of the week is sunday. It is wery confusing on some cultures. image Roughly 44% of world populations starts week from monday image

Describe the solution you'd like Give option for users to select first day of the week. Default value may be from teable instance settings or from browser locale and ability to overwrite it for user in profile settings. This way every member of multy-culture team will have preferred options and better defaults

Describe alternatives you've considered Default first week day in date picker just from browser locale

Additional context Calendar view properly localized and starts from monday on RU locale. So maybe it is just an localization bug. image

InsaneCake avatar Dec 09 '24 14:12 InsaneCake

Teable assumes that if you have selected English language, you are interested in en-US variant of calendar. It starts week from Sunday: https://github.com/date-fns/date-fns/blob/6c70ac6d073ebe869e42795f5e71dfecf5abbea0/src/locale/en-US/index.ts#L16-L27

If we changed defaults to en-GB, it would start week from Monday: https://github.com/date-fns/date-fns/blob/6c70ac6d073ebe869e42795f5e71dfecf5abbea0/src/locale/en-GB/index.ts#L15-L26


Implementing this feature request would be straightforward, as there is an option in the upstream to overwrite locale's default behavior: https://daypicker.dev/docs/localization#first-date-of-the-week

It's very simple, you have to add weekStartsOn={ AppContext.weekStart } after: https://github.com/teableio/teable/blob/5afcd2641269908ce6e51efc5a9eba12f06b0b29/packages/sdk/src/components/editor/date/EditorMain.tsx#L107-L108

and user setting there:

kpodp0ra avatar Dec 12 '24 04:12 kpodp0ra

Teable assumes that if you have selected English language, you are interested in en-US variant of calendar. It starts week from Sunday: https://github.com/date-fns/date-fns/blob/6c70ac6d073ebe869e42795f5e71dfecf5abbea0/src/locale/en-US/index.ts#L16-L27

If we changed defaults to en-GB, it would start week from Monday: https://github.com/date-fns/date-fns/blob/6c70ac6d073ebe869e42795f5e71dfecf5abbea0/src/locale/en-GB/index.ts#L15-L26

Sounds right, so in my case i should have ru-RU locale, but datepicker in cell still starts from sunday and not translated to russian. Date selection in toolbar of calendar view is translated properly and starts from monday (пн). I have checked additionaly - datepicker is the same for all languages.

InsaneCake avatar Dec 12 '24 10:12 InsaneCake

I've added PR that fixes that issue.

Waiting for project owner's decision whether they want to have an additional field in the user settings under ‘language’ to select the user's preferred first day of the month.

kpodp0ra avatar Dec 12 '24 15:12 kpodp0ra