I'm using an angular directive to handle dates
My policy is this:
app.directive("formatDate", function() {
return {
require: 'ngModel',
link: function(scope, elem, attr, modelCtrl) {
modelCtrl.$formatters.push(function(modelValue) {
if (modelValue){
return new Date(modelValue);
}
else {
return null;
}
});
}
};
});
When I display the date of my listing comes the correct date. But when I open the modal for data editing the date comes with a less day.
Let's see;
My listing looks like this:
InthelistingIformatthedatethisway:
<td>{{pes.dataNascimento|date:'dd/MM/yyyy'}}</td>
ButwhenIclickonthemodaltochangetheselectedperson,thedateisloadedwithonedaylessthen:
Mycomponentlookslikethis:
<divclass="es col-md-4">
<label class="lb" style="margin-top: -5px;">Data Nascimento <label class="lb1"
data-toggle="tooltip" title="ÁREA DE TEXTO OBRIGATÓRIO"> *</label>
</label> <input title="ÁREA DE TEXTO OBRIGATÓRIO" style="margin-top: -70px;"
required="required" class="form-control " name="data" id="data" type="date" ng-model="pessoa.dataNascimento" format-date/>
</div>
I do not know if it's relevant but when you click on change the data captured from the listing it looks like this:
Does anyone have any idea what could be happening ??