1
I use the following code to catch the start and end of the week.
pegaData() {
moment().locale();
var agora;
var datainicial;
var datafinal;
agora = moment().format('DD-MM-YYYY');
console.log(agora);
if(agora = 'Thusday'){
datainicial = moment().subtract(4, 'days').calendar();
datainicial = moment().format('DD-MM-YYYY');
datafinal = moment().add(2, 'days').calendar();
datafinal = moment().format('DD-MM-YYYY');
}
console.log(datainicial);
console.log(datafinal);
}
And the code returns right the initial and final date, only not in the format I need, which would be 'DD-MM-YYYY'
.
But at the moment of conversion, as I call the Moment again, it converts the current date, as I can format the date without calling the Moment again?
Thank you very much man, where I saw about the day method Moment.js did not have, thank you very much for showing me it, helped too much!!!!
– Gustavo Oliveira