1
try {

await axios.post(`${server}/tasks`, {

estimateAt: newTask.date,
})

Hello, I need to filter the "tasks" by date, to be displayed in other components of my company's App. Example:

 try {

 if(estimateAt >= 01/04/2020 && estimateAt <= 30/04/2020) {

 {April}
} else
if(estimateAt >= 01/05/2020 && estimateAt <= 31/05/2020) {

 {May}

 await axios.post(`${server}/tasks`, {

estimateAt: newTask.date,
})

Remember that the application has a navigation (createDrawerNavigator) that appears every month. I need to solve the problem, because when the user entered a task, it is displayed every month. Example: The user entered a task in April, the task is shown in May, June, July, August ...

to solve the problem I thought of creating a conditional structure to solve the problem

AFDABH
  • 11
  • 1
  • Your pseudocode suggests that you want to display the data grouped by months. If so, have a look at this answer: https://stackoverflow.com/a/41889045/1790728 – Chris Apr 18 '20 at 18:17
  • This question really needs some clarity. If you just want to filter on month, then assuming *estimateAt* is a Date object, then all the April tasks would be `if (estimateAt.getMonth() == 3)`. But maybe there's more to it? – RobG Apr 19 '20 at 02:06

0 Answers0