0
Hello,
I wanted to put today’s pre-set date in a date field on view startup.
I tried so:
Component:
this.MeuForm = this.fb.group({
dataInicio: [{date: {year: (new Date()).getFullYear(), month: (new Date()).getMonth() + 1, day: (new Date()).getDate()}}],
dataFim: ''
});
<div class="col-md-2">
<div class="form-group">
<label class="control-label" for="dataInicio">Data Inicial</label>
<dx-date-box type="date" width="100%" displayFormat="dd/MM/yyyy"
formControlName="dataInicio"></dx-date-box>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label class="control-label" for="dataFim">Data Final</label>
<dx-date-box type="date" width="100%" displayFormat="dd/MM/yyyy"
formControlName="dataFim"></dx-date-box>
</div>
</div>
Upshot:
It turns out that, first, there is no date today and second, I no longer have the icon there to choose another date.
dataFim: new Date(), take a look at the documentation of your library what kind of data it expects.
– Eduardo Vargas
worked, thanks
– LeoHenrique