Problem format imput date

0

My problem is that I use this:

<input type="date" class="form-control" id="fechaInicio" ng-model="cita.fechaInicio" />

But I see the date in this format: 2018/02/02 and I get an error I do not want to save it so I need to change the format to 2018-02-02.

I tried to do it in a thousand ways even trying to import libraries with external datepickers but I can not do it because I do not integrate them well to see if you send me a cable, because I want the calendar to choose the date.

I add info: I managed to visualize the calendar with the correct date all perfect with the bootstrap datepicker but at the time of adding it does not add the quote that is because some kind of error originates (I am using Angular). Here the code:

<div class="form-group">
      <label for="fechaInicio">Fecha de la cita:</label>

      <div class="input-group date fecha">
        <input type="text"  class="form-control" id="fechaInicio" ng-model="cita.fechaInicio"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
      </div>
      <script type="text/javascript">
      $('.fecha').datepicker({
        format: "yyyy-mm-dd",
        language: "es"
      });
      </script>

    </div>

The console does not give me an error, and I do not know exactly why it fails me.

    
asked by Peter 01.11.2017 в 17:56
source

1 answer

1

if you are using datepickers you can format it there

$('.datepicker').datepicker({
    format: 'mm/dd/yyyy',
    startDate: '-3d'
});

or also format from the input example

<input class="datepicker" data-date-format="mm/dd/yyyy"> 

Ós I leave the league link

    
answered by 01.11.2017 в 18:04