-
Notifications
You must be signed in to change notification settings - Fork 18
Date-fns #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Date-fns #1
Conversation
hyfi06
left a comment
There was a problem hiding this 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); |
There was a problem hiding this comment.
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
| const lastYear = sub(today, {years:1}); | ||
| const lastTwoYear = sub(today, {years:2}); | ||
| const lastThreeYear = sub(today, {years:3}); |
There was a problem hiding this comment.
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
| const lastMonth = sub(today, {months:1}); | ||
| const lastTwoMonth = sub(today, {months:2}); | ||
| const lastThreeMonth = sub(today, {months:3}); |
There was a problem hiding this comment.
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') | ||
| }, | ||
|
|
||
| ]; |
There was a problem hiding this comment.
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
| { | ||
| 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') | ||
| }, |
There was a problem hiding this comment.
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
No description provided.