The link to datetimepicker
that I use this here
My problem is this:
I want to obtain the date that I indicate, but when I click on an external button, it indicates the previous date, not the last date that I indicate.
Ex: if I indicate the date 25/07/2017
this indicates the date previously selected ( 06/02/2017
date today, of the publication) how could I get the last date that I indicate in that input
.
$('.datetimepicker').datetimepicker({
daysOfWeekDisabled: [0, 6],
icons: {
time: "fa fa-clock-o",
date: "fa fa-calendar",
up: "fa fa-arrow-up",
down: "fa fa-arrow-down"
},
//defaultDate: new Date(),
minDate: new Date(),
disabledHours: [0, 1, 2, 3, 4, 5, 6, 7, 17, 18, 19, 20, 21, 22, 23, 24],
enabledHours: [8, 9, 10, 11, 12, 13, 14, 15, 16],
});
$('#crear_fecha').data("DateTimePicker").minDate(new Date());
$(document).on('click', '#Crear', function() {
alert($('#crear_fecha').data('DateTimePicker').date()._i);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/es-do.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.45/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.45/css/bootstrap-datetimepicker.min.css" />
<input type='text' class="form-control datetimepicker" name='crear_fecha' id='crear_fecha' />
<button type="button" id="Crear" class="btn btn-primary">
<span class="fa fa-plus"></span><span class="hidden-xs"> Agregar</span>
</button>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"></script>
NOTE: The calendar is not due to an error on the web, but if you scroll the browser scroll, it will be displayed low.