ui fix
This commit is contained in:
parent
7b70c45aaf
commit
7341f42f86
@ -163,14 +163,16 @@ export const groupEarnings = (earnings) => {
|
|||||||
return Object?.entries(
|
return Object?.entries(
|
||||||
earnings
|
earnings
|
||||||
?.reduce((acc, item) => {
|
?.reduce((acc, item) => {
|
||||||
const dateKey = new Intl.DateTimeFormat('en-US', {
|
const date = new Date(item?.date);
|
||||||
|
const berlinDate = new Intl.DateTimeFormat('en-US', {
|
||||||
day: '2-digit',
|
day: '2-digit',
|
||||||
month: 'short',
|
month: 'short',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
}).format(new Date(item?.date));
|
timeZone: 'Europe/Berlin'
|
||||||
|
}).format(date);
|
||||||
|
|
||||||
if (!acc[dateKey]) acc[dateKey] = [];
|
if (!acc[berlinDate]) acc[berlinDate] = [];
|
||||||
acc[dateKey]?.push(item);
|
acc[berlinDate]?.push(item);
|
||||||
return acc;
|
return acc;
|
||||||
}, {})
|
}, {})
|
||||||
)
|
)
|
||||||
@ -180,9 +182,13 @@ export const groupEarnings = (earnings) => {
|
|||||||
date,
|
date,
|
||||||
// Sort earnings within the date by time
|
// Sort earnings within the date by time
|
||||||
earnings?.sort((a, b) => {
|
earnings?.sort((a, b) => {
|
||||||
const timeA = new Date(`1970-01-01T${a?.time}`);
|
const berlinTimeA = new Date(
|
||||||
const timeB = new Date(`1970-01-01T${b?.time}`);
|
new Date(`${item?.date}T${a?.time}`).toLocaleString('en-US', { timeZone: 'Europe/Berlin' })
|
||||||
return timeB - timeA;
|
);
|
||||||
|
const berlinTimeB = new Date(
|
||||||
|
new Date(`${item?.date}T${b?.time}`).toLocaleString('en-US', { timeZone: 'Europe/Berlin' })
|
||||||
|
);
|
||||||
|
return berlinTimeB - berlinTimeA;
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user