Create querystring with parameters of moment.js

0

I am trying to make a redirect to a url that I am building and in it I need that this date as well as the schedule that the user selected in a form. The problem I have is that in my new url both fields must be linked with the format 'YYYY-MM-DDT00: 00' and I can not put them together that both are part of the same query String ...

Any ideas? Thanks!

On the one hand I have the date I get from the form:

urlModel.fechaSalida = 
moment(fechaSalida,'DD/MM/YYYY').format('YYYY-MM-DDT');

and on the other the schedule:

urlModel.horarioSalida = moment().format('HH:mm:ss');
    
asked by Pil 08.02.2018 в 23:07
source

1 answer

0

You can compose the% co_of final% as follows.

const momentA = moment().format('YYYY-MM-DDT')
const momentB = moment().format('HH:mm:ss')

const url = 'https://moment.exaple.com/?date_time=${momentA} ${momentB}'

console.log(url)
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>
    
answered by 08.02.2018 в 23:59