List a date period by the day of the week?

Asked

Viewed 40 times

-1

I need to do a function in Javascript/jQuery that I take the value of two fields of date format and it returns me a sequence of dates as I choose: 1st or 2nd Tuesday of the selected period in the fields data1 and data2. I don’t know where to start, I’m a beginner...

Exp:

data1 = 06/05/2019;
data2 = 01/10/2019;
opção = 1ª segunda-feira;


resultado = 
06/05/2019 
03/06/2019 
01/07/2019 
05/08/2019 
02/09/2019 
.... até a data final caso seja compatível com a opção selecionada. 
  • Show the code you’ve already implemented and highlight the part where you’re having trouble. Error message and stack trace would greatly help to debug your code.

  • So @Augustovasques as I stated in the statement, I haven’t started anything yet. I was reading about the function `new Date() and I couldn’t quite understand how it works when I type a date by input. (I know it shows me the date in full format including hours, minutes.,)! I’d like to at least find a starting point!

1 answer

1


Hello @Rodrigo-Henry, I made this prototype on Jsfiddle to try to help you understand and improve the process. It is well "raw" and can (and should) be improved. See if it meets you. Any doubt, feel free to question. Link: https://jsfiddle.net/GustavoAdolfo/t61dLr5j/81/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.