如何在matDatepicker中手动设置日期格式(角度4)

时间:2017-11-30 14:07:23

标签: javascript angular material-design

    <mat-form-field>
    <input matInput name=""       
     [matDatepicker]="myDatepicker"  
      [max]="maxDate"                                                                                                        
        placeholder="Select Date Of Birth"                                                                   
         id="dateOfBirth"                                                                   
          [value]="value"                                                                    
           onkeydown="return false" />                                                             
<mat-datepicker-toggle matSuffix [for]="myDatepicker"></mat-datepicker-toggle>
    <mat-datepicker #myDatepicker mat-open-on-focus></mat-datepicker>
    </mat-form-field>

这是我为双向绑定实现的代码段。

Value return JS date object output as follow 

Current output:
"Mon Jan 01 1900 00:00:00 GMT+0530 (India Standard Time)"

Required Output:
01/01/1990 (MM/DD/YYYY).

我已经引用了以下链接,但没有得到预期的输出 -     Angular 2 Material 2 datepicker date format

0 个答案:

没有答案