Commit 5c91091b authored by johnnyloreano's avatar johnnyloreano
Browse files

Comentarios pra entender um método

parent f9d09b69
......@@ -26,8 +26,12 @@ function RedeHorarioCard({ mentoria }) {
.sort((dateTimeA, dateTimeB) => dateTimeA.dayOfTheMonth.split('/')[1] - dateTimeB.dayOfTheMonth.split('/')[1]);
const timeInformation = sortedTimes.map((dt) => {
// Quebra o dia onde tiver a string /, e tira os espaços em branco
let dayOfTheMonth = dt.dayOfTheMonth.replace(/ /g, '').split('/');
// Loop dentro da data, se encontrar algum numero com tamanho 1, significa que precisa colocar o 0
// Por ex, mês 8 tem tamanho 1, precisa ficar 08
for (let i = 0; i < 2; i += 1) if (dayOfTheMonth[i].length === 1) dayOfTheMonth[i] = `0${dayOfTheMonth[i]}`;
// Junta o array, separando por /
dayOfTheMonth = dayOfTheMonth.join('/');
// eslint-disable-next-line max-len
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment