mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-12-22 01:47:08 +00:00
Angular material docs updated,
+ @angular/material-moment-adapter added to package.json
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/** No CSS for this example */
|
||||
@@ -0,0 +1,5 @@
|
||||
<mat-form-field>
|
||||
<input matInput [matDatepicker]="dp" placeholder="Verbose datepicker" [formControl]="date">
|
||||
<mat-datepicker-toggle matSuffix [for]="dp"></mat-datepicker-toggle>
|
||||
<mat-datepicker #dp></mat-datepicker>
|
||||
</mat-form-field>
|
||||
@@ -0,0 +1,44 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
|
||||
|
||||
import * as moment from 'moment';
|
||||
|
||||
// See the Moment.js docs for the meaning of these formats:
|
||||
// https://momentjs.com/docs/#/displaying/format/
|
||||
export const MY_FORMATS = {
|
||||
parse : {
|
||||
dateInput: 'LL'
|
||||
},
|
||||
display: {
|
||||
dateInput : 'LL',
|
||||
monthYearLabel : 'MMM YYYY',
|
||||
dateA11yLabel : 'LL',
|
||||
monthYearA11yLabel: 'MMMM YYYY'
|
||||
}
|
||||
};
|
||||
|
||||
/** @title Datepicker with custom formats */
|
||||
@Component({
|
||||
selector : 'datepicker-formats-example',
|
||||
templateUrl: 'datepicker-formats-example.html',
|
||||
styleUrls : ['datepicker-formats-example.css'],
|
||||
providers : [
|
||||
// `MomentDateAdapter` can be automatically provided by importing `MomentDateModule` in your
|
||||
// application's root module. We provide it at the component level here, due to limitations of
|
||||
// our example generation script.
|
||||
{provide : DateAdapter,
|
||||
useClass: MomentDateAdapter,
|
||||
deps : [MAT_DATE_LOCALE]
|
||||
},
|
||||
|
||||
{provide : MAT_DATE_FORMATS,
|
||||
useValue: MY_FORMATS
|
||||
}
|
||||
]
|
||||
})
|
||||
export class DatepickerFormatsExample
|
||||
{
|
||||
date = new FormControl(moment());
|
||||
}
|
||||
Reference in New Issue
Block a user