Share feedback, ideas and get community help

Updated 10 months ago

Custom Variables Doubt

I want to create a variable that displays today's date plus 10 days in dd/mm/yyyy format.

How can I do it? What language does the editor understand? I have tried with JavaScript, but I can't get it to work correctly.
N
B
4 comments
Solution Example: πŸ˜…

Plain Text
let fecha = new Date();
fecha.setDate(fecha.getDate() + 10); 
return fecha.toLocaleDateString(); 


Example Show the span of two dates:

Plain Text
let fechaActual = new Date();

let fechaMasDiez = new Date(fechaActual);
fechaMasDiez.setDate(fechaMasDiez.getDate() + 10);
let options = { day: '2-digit', month: '2-digit', year: 'numeric' };
let fechaTextoDiez = fechaMasDiez.toLocaleDateString('es-ES', options);

let fechaMasQuince = new Date(fechaActual);
fechaMasQuince.setDate(fechaMasQuince.getDate() + 15);
let fechaTextoQuince = fechaMasQuince.toLocaleDateString('es-ES', options);

return `${fechaTextoDiez} y el ${fechaTextoQuince}`;

```
works fine on my end!
Yes, I found the solution and indicated it. πŸ˜‰
Add a reply
Sign up and join the conversation on Discord