Skip to content

Commit

Permalink
pkp/pkp-lib#9527 Attempt to stabilize StatsPage data
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec committed Dec 19, 2023
1 parent 4c53d90 commit 96e61d9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/Container/StatsPage.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function getRandomTimeline(startDate, endDate, timelineInterval) {
timeline.push({
date: startDate.toISOString().split('T')[0],
label: startDate.toString().split(' ').slice(1, labelSplice).join(' '),
value: Math.floor(Math.random() * 2000) + 3000,
value: Math.floor(startDate.getDate() * 2000) + 3000,
});
if (timelineInterval === 'month') {
startDate.setMonth(startDate.getMonth() + 1);
Expand Down Expand Up @@ -580,8 +580,13 @@ const PublicationStatsPageWithDataAndTemplate = {
</div>
`,
data() {
const dateEndMax = new Date(new Date().setDate(new Date().getDate() - 1));
const startDate = new Date();
const fakeToday = 'Tue Dec 19 2023 16:00:27 GMT+0100';
const dateEndMax = new Date(
new Date().setDate(new Date().getDate(fakeToday) - 1),
);

const startDate = new Date(fakeToday);

startDate.setDate(dateEndMax.getDate() - 30);
return {
apiUrl: '/api/v1/stats/publications',
Expand Down

0 comments on commit 96e61d9

Please sign in to comment.