angular custom forms control

Viewed 37

I have a doubt, I have a data input, currently I'm using angular's mydatepicker

<div  class="input-group ">
<input class="form-control" readonly placeholder="Selecione uma data"  id="inputData" angular-mydatepicker name="datepicker"
formControlName="data"[options]="myOptions"  [locale]="locale" (click)="dp.toggleCalendar()" #dp="angular-mydatepicker"/>
  <div class="input-group-append">
    <button type="button" class="btn btn-secondary" (click)="dp.toggleCalendar()" >
      <i class="fa fa-calendar" aria-hidden="true" ></i>
    </button>
  </div>
{
     "isRange":false,
     "singleDate":{
         "date":{ 
              "year":2022,
              "month":6, 
              "day":14 
         },
        "jsDate":"2022-06-14T03:00:00.000Z", 
        "formatted": "14/06/2022", 
        "epoc":1655175600
     },
     "dateRange":null
}

I would like to know if there is any way in view(html) to show the date in the format dd/mm/yyyy and in the component yyyy-mm-dd

it would be possible ?

1 Answers

Use this pipe in your table Field

{{variable.jsDate| date : 'dd-MM-yyyy hh:mm a'}}

Related