Skip to content

Conversation

@Armando101
Copy link

No description provided.

Copy link

@hyfi06 hyfi06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments

const spanish = require('date-fns/locale/es');

// today
const today = new Date(2020, 0, 1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La fecha la estás fijando, esta debe de ser la que llega como parámetro de la función

Comment on lines +15 to +17
const lastYear = sub(today, {years:1});
const lastTwoYear = sub(today, {years:2});
const lastThreeYear = sub(today, {years:3});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cuando repites código similar es señal que debes implementar una función o una clase

Comment on lines +20 to +22
const lastMonth = sub(today, {months:1});
const lastTwoMonth = sub(today, {months:2});
const lastThreeMonth = sub(today, {months:3});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cuando repites código similar es señal que debes implementar una función o una clase

endAt: format(endOfMonth(lastThreeMonth), 'yyyy/MM/dd')
},

];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cuando repites código similar es señal que debes implementar una función o una clase

Comment on lines +50 to +81
{
label: format(lastYear, 'yyyy'),
startAt: format(startOfYear(lastYear), 'yyyy/MM/dd'),
endAt: format(endOfYear(lastYear), 'yyyy/MM/dd')
},
{
label: format(lastTwoYear, 'yyyy'),
startAt: format(startOfYear(lastTwoYear), 'yyyy/MM/dd'),
endAt: format(endOfYear(lastTwoYear), 'yyyy/MM/dd')
},
{
label: format(lastThreeYear, 'yyyy'),
startAt: format(startOfYear(lastThreeYear), 'yyyy/MM/dd'),
endAt: format(endOfYear(lastThreeYear), 'yyyy/MM/dd')
},

// Filters per months
{
label: format(lastMonth, 'MMMM', {locale: spanish}),
startAt: format(startOfMonth(lastMonth), 'yyyy/MM/dd'),
endAt: format(endOfMonth(lastMonth), 'yyyy/MM/dd')
},
{
label: format(lastTwoMonth, 'MMMM', {locale: spanish}),
startAt: format(startOfMonth(lastTwoMonth), 'yyyy/MM/dd'),
endAt: format(endOfMonth(lastTwoMonth), 'yyyy/MM/dd')
},
{
label: format(lastThreeMonth, 'MMMM', {locale: spanish}),
startAt: format(startOfMonth(lastThreeMonth), 'yyyy/MM/dd'),
endAt: format(endOfMonth(lastThreeMonth), 'yyyy/MM/dd')
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Estos datos no se actualizan con el parámetro date, porque ya los fijaste en la linea 12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants