0
Person, I have a simple form where the user should type the time.
<form name="formAgendamento" class="formAgendamento">
<label>Dia</label>
<input class="form-control dia" type="date" name="dia" ng-model="agendamento.dia" required>
<label>Hora</label>
<input class="form-control hora" type="time" name="hora" ng-model="agendamento.hora" required>
<button class="btn btn-primary" ng-disabled="formAgendamento.$invalid" ng-click="agendar(agendamento)">Agendar</button>
</form>
But the time goes in the following format to the angular:
I need just the hours and minutes (17:17)... How do I get only this data? I’m trying to use the "split()" javascript, but in the console appears a warning saying that split is not a function.
https://stackoverflow.com/a/19346876/4551469 help this link
– rLinhares
I think so @rLinhares
– GustavoSevero
Here without using the split, simpler:
var horaMinuto = new Date().toString().match(/\d{2}\:\d{2}/)[0];
– Leandro Simões
I don’t understand how Moment.js picks up the date informed by the user... From what I saw in the documentation it picks up the data from the system.
– GustavoSevero