mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Start of week according to locale in SessionsWeekly
This commit is contained in:
parent
c0c1138e2e
commit
68e2fe5d6f
1 changed files with 32 additions and 26 deletions
|
|
@ -10,6 +10,10 @@ export function SessionsWeekly({ websiteId }: { websiteId: string }) {
|
|||
const { data, ...props } = useWebsiteSessionsWeekly(websiteId);
|
||||
const { dateLocale } = useLocale();
|
||||
const { labels, formatMessage } = useMessages();
|
||||
const { weekStartsOn } = dateLocale.options;
|
||||
const daysOfWeek = Array(7)
|
||||
.fill(weekStartsOn)
|
||||
.map((d, i) => (d + i) % 7);
|
||||
|
||||
const [, max] = data
|
||||
? data.reduce((arr: number[], hours: number[], index: number) => {
|
||||
|
|
@ -50,7 +54,9 @@ export function SessionsWeekly({ websiteId }: { websiteId: string }) {
|
|||
);
|
||||
})}
|
||||
</div>
|
||||
{data?.map((day: number[], index: number) => {
|
||||
{data &&
|
||||
daysOfWeek.map((index: number) => {
|
||||
const day = data[index];
|
||||
return (
|
||||
<div key={index} className={styles.day}>
|
||||
<div className={styles.header}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue