Metabase: Allow organizations to determine the start of their week

Created on 22 Jan 2016  ·  51Comments  ·  Source: metabase/metabase

Right now we use Sunday as the start of the week.

http://discourse.metabase.com/t/how-are-mysql-dates-queried-for-this-week-and-last-week/185/2 brings up a case where a company has Monday as the start of the week.

:arrow_down: Please click the :+1: reaction instead of leaving a +1 or update? comment

AdministratioSettings MisTimezones P1 New Feature

Most helpful comment

We're changing the "Formatting" tab to "Localization" in 0.36, and I think this setting could fit in nicely there among the other date and time options.

Edit: just to clarify, this setting is still slotted for version _0.37_, not version 0.36. We're almost done with 0.36, and this issue is more complicated that just adding a dropdown to the settings.

image

All 51 comments

+1 (Standard in Europe)

:+1:

Support-wise this may be difficult since AFAIK Postgres and most other databases we support hardcode Sunday as the first day of the week

:+1:

:+1:

👍 As you can see here: https://en.wikipedia.org/wiki/Week#/media/File:First_Day_of_Week_World_Map.svg
The first day of the week is not Sunday for quite a big part of the population.

Would make sense to make configurable / use locale setting

I would vote for _configurable_ instead of _locale setting_. Some business have their own start of week which may be Monday or some other day, different than the standard locale.

Related to #3449 #2517

👍

+1

Hey everyone, one way we prioritize issues is by sorting them by the number of 👍 reactions on each issue's description. So instead of leaving +1 or 👍 comments, please just upvote by adding a reaction to the issue description.

Hi @camsaul Added a thumbs up, the current situation is rather annoying for us as business is used to working with weeks that start on monday.

I'm trying to resolve this. and have managed to make changes mentioned in comments from #2517 and make this configurable. I'm new to clojure and nodejs development. is there any guidance on how I can test (other than lein test) this?

I should mention I tested this manually and I can switch locales correctly at least between en and en_gb

examples:
in config:
image

Question (with en/default/current behaviour):
image

Question (with en_gb):
image

Before I raise a PR, is this something that's what you are all looking for? This implementation is at least enough for our organisation. assuming I haven't broken anything else or missed anything.

@atharvai Does the locale impact anything else? Locale is something that a lot of people also link to number formatting etc.

I would prefer the setting to just be:
First day of week (Sunday, Monday).

Other than that the change looks great to me, it's exactly what we would like.

Hopefully this could be added quick as it's currently the only thing management is really complaining about.

so the locale setting set's moment.locale(<config value>) in formatting.js. This is global. One thing, I'd like is to make locale consistent across all Metabase.
Setting day and manually "calculating" just for dates in a specific place seems incorrect and potentially misleading. The current implementation is in an example. It does date add and subtract to force Sunday as first day of week.

I do wonder if moment.js is used for formatting numbers, currency etc. But a good point. Any pointers would help. I'm new to Clojure and Nodejs so I'm still finding my way around the code.

When internationalizing applications, it is expected a locale sets all the correct display formats. So a single setting to control all datetime formats would be preferred.

Looks like they use humanize-plus node module for number formatting.

I think these are included in moments by default: https://github.com/moment/moment/tree/master/locale
here's the ja (japanese) locale:
image

One thing to be mindful of is the language is still English so other than the symbols defined in locale files, everything will be in English.

Hi!

Is there any news on this? Is this feature already implemented/released

Or when exactly is this planned for?

@salsakran Hi! This proposal was made some time ago can you give us an update on this?

Any updates on this?

I am no longer using Metabase and won't be maintaining any of my code changes. Please copy them to your fork.

Can someone please tell me how to change the week order at least hard coded?
I need to make it german - so Monday is the first weekday.

Hi, any progress regarding this issue? Yes, Sunday as first day in week is an issue for me and my company (most of world is using Monday as first day in week anyway!). And another question - can you implement a mechanism to highlight work days to make them different at first glance? Thank you.

Hi, this issue is very urgent for us as well. When can you implement the feature of determining that the beginning of the week is Monday? @salsakran

Hola, este problema es muy urgente para nosotros también. ¿Cuándo puede implementar la función de determinar que el comienzo de la semana es el lunes?

Sunday as first day in week is an issue for me and my company (most of company is using Monday as first day in week anyway!).

This option doesn't exist since 0.30.0.
We need it each day....
Possible to schedule it ?

In 0.30.0 and more, this option look like linked to TimeZone setting.
It's right ?

It would be a great addition to Metabase! 👍

Hi, it will be even more usefull now that you offer "Smart number" as a visualization type.
Starting on sunday doesn't fit most of us...

Would be great to have a schedule (like approximative one: We won't do it / OK, we will do it in 3 months or less / OK, we will do it later) :)

Can only add my +1 on this. Monday is the standard first business day of the week as is meter for distance calculations.

This is quite mindblowing to go through steps like this:

(date_trunc('week', CAST((CAST({the_date} AS timestamp) + INTERVAL '1 day') AS timestamp)) - INTERVAL '1 day')

when all we want is:

date_trunc('week', {the_date})

Please give us an option to turn this off.

Are there any plans to implement this? It would be very helpful for my use case as well.

This is really needed!

Is there any update on this (determine start day of week) in the new version? Thanks!

Any updates on this? This would be huge for us!

Agreed. This is a must

Any updates? This would be really valuable for us

It's been 3 months in P1. Any updates?

Up, could we please merge this ?

I noticed what I think is a related (or same) issue...

I have a dashboard with 2 charts on it, "by week". One of the by-weeks I did in sql with a simple date_trunc('week', created_at) and the other was done via the metabase query builder. I noticed that the two are not in agreement on data, and I think that they are off-by-one day.

This is the sql generated by the metabase by-week:

SELECT (date_trunc('week', CAST((CAST("source"."created_at" AS timestamp) + INTERVAL '1 day') AS timestamp)) - INTERVAL '1 day') AS "created_at" ...

This query shows the difference between the two methods and does cause the two approaches "week windows" to be off by one day...

with d as (select TO_TIMESTAMP('2020-02-17', 'YYYY-MM-DD') as some_monday)
select
    date_trunc('week', some_monday) as date_trunc,
    (date_trunc('week', CAST((CAST(some_monday AS timestamp) + INTERVAL '1 day') AS timestamp)) - INTERVAL '1 day') AS "metabase"
from d

# output
date_trunc: 2020-02-17 00:00:00+00
metabase:   2020-02-16 00:00:00

Why all of the crazy casting / transformation? Why not just use a simple date_trunc?

any updates on this feature?

Hi all, this is a basic feature for many of locales.
It seems that was in P1 but since 5 months.

Do you have any updates on this feature.

Many thanks in advance,

There was an update on March 10th, where this got added to roadmap of 0.37. There's 45 other P1s.
I don't have a timeline for 0.37, but probably 2-3 months after 0.36

We're changing the "Formatting" tab to "Localization" in 0.36, and I think this setting could fit in nicely there among the other date and time options.

Edit: just to clarify, this setting is still slotted for version _0.37_, not version 0.36. We're almost done with 0.36, and this issue is more complicated that just adding a dropdown to the settings.

image

It looks like we can no-longer set locale to en_GB?

@adbrown101 Unless you have manually added a en_GB translation, then no. Metabase only includes en_US of the English-based languages. You can create and update translations here: https://poeditor.com/join/project/ynjQmwSsGh
But it sounds like a different question or problem, so please use the forum: https://discourse.metabase.com/

Just follow ISO 8601 and we're fine. If you think Sunday is the first day of the week you're just wrong. This is why we have standardisation.

This will be part of 0.37.0 - was fixed by PR #13090 - this is how it looks in Admin > Settings > Localization:
image

Woohoo!! Very excited for this!

On Wed, Oct 7, 2020 at 2:12 PM flamber notifications@github.com wrote:

This will be part of 0.37.0 - was fixed by PR #13090
https://github.com/metabase/metabase/pull/13090 - this is how it looks
in Admin > Settings > Localization:
[image: image]
https://user-images.githubusercontent.com/1447303/95382406-e5c18800-08e9-11eb-92d8-a95b7d7c899a.png


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/metabase/metabase/issues/1779#issuecomment-705167782,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ALPH5H27EXQNW5YFITIM673SJTDSLANCNFSM4BZKJFXA
.

@jacobr2009 heads up i edited your comment to remove your cell phone number from your signature.

@dpsutton much appreciated 😊

Tak od 0.37 bude umet metabase zmenit vychozi den tydne!!!

Akorat se to bude vztahovat jen na ty "klikaci" dotazy, tak pak muzeme
zkusit jak se to zmenilo, az ji vydaji.

Lubor Nosek
NETIUM s.r.o.
m: +420602356969
w: www.netium.cz e: [email protected]

On Wed, Oct 7, 2020 at 10:12 PM flamber notifications@github.com wrote:

This will be part of 0.37.0 - was fixed by PR #13090
https://github.com/metabase/metabase/pull/13090 - this is how it looks
in Admin > Settings > Localization:
[image: image]
https://user-images.githubusercontent.com/1447303/95382406-e5c18800-08e9-11eb-92d8-a95b7d7c899a.png


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/metabase/metabase/issues/1779#issuecomment-705167782,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACWJC5YUNVN42HLY4M6X4L3SJTDSLANCNFSM4BZKJFXA
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rafaelveloso picture rafaelveloso  ·  44Comments

chadbean picture chadbean  ·  42Comments

ayukidawe picture ayukidawe  ·  85Comments

iwozzy picture iwozzy  ·  42Comments

hopsoft picture hopsoft  ·  53Comments