mirror of
https://github.com/umami-software/umami.git
synced 2026-02-15 18:15:35 +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 { data, ...props } = useWebsiteSessionsWeekly(websiteId);
|
||||||
const { dateLocale } = useLocale();
|
const { dateLocale } = useLocale();
|
||||||
const { labels, formatMessage } = useMessages();
|
const { labels, formatMessage } = useMessages();
|
||||||
|
const { weekStartsOn } = dateLocale.options;
|
||||||
|
const daysOfWeek = Array(7)
|
||||||
|
.fill(weekStartsOn)
|
||||||
|
.map((d, i) => (d + i) % 7);
|
||||||
|
|
||||||
const [, max] = data
|
const [, max] = data
|
||||||
? data.reduce((arr: number[], hours: number[], index: number) => {
|
? data.reduce((arr: number[], hours: number[], index: number) => {
|
||||||
|
|
@ -50,7 +54,9 @@ export function SessionsWeekly({ websiteId }: { websiteId: string }) {
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
{data?.map((day: number[], index: number) => {
|
{data &&
|
||||||
|
daysOfWeek.map((index: number) => {
|
||||||
|
const day = data[index];
|
||||||
return (
|
return (
|
||||||
<div key={index} className={styles.day}>
|
<div key={index} className={styles.day}>
|
||||||
<div className={styles.header}>
|
<div className={styles.header}>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue