angular material date range picker code example
Example 1: material datepicker
<mat-form-field class="example-full-width" appearance="fill">
<mat-label>Choose a date</mat-label>
<input matInput [matDatepicker]="picker">
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<button mat-raised-button (click)="picker.open()">Open</button>
Example 2: angular material number picker
<md-input-container>
<input
mdInput
type="number"
id="myNumber"
/>
</md-input-container>
Example 3: date time picker in angular material
<input mdc-datetime-picker="" date="true" time="true" type="text" id="datetime"
placeholder="Date" show-todays-date="" minutes="true" min-date="date" show-icon="true"
ng-model="dateTime" class=" dtp-no-msclear dtp-input md-input">
Example 4: date range picker in angular 8
preDefinedRanges: [{ safd name: 'Day After tomorrow', value: { start: moment().add(2, 'days'), end: moment().add(2, 'days'), } },{ name: 'This week', value: { start: moment(), end: moment().add(7, 'days'), } }]
Example 5: angular material datepicker range get value
<mat-form-field appearance="standard">
<mat-label>{{reportField.value.label}}</mat-label>
<mat-date-range-input [rangePicker]="dateRangePicker">
<input matStartDate
placeholder="Start date"
#dateRangeStart>
<input matEndDate
placeholder="End date"
#dateRangeEnd
(dateChange)="dateRangeChange(dateRangeStart, dateRangeEnd)">
</mat-date-range-input>
<mat-datepicker-toggle matPrefix
[for]="dateRangePicker">
</mat-datepicker-toggle>
<mat-date-range-picker #dateRangePicker></mat-date-range-picker>
</mat-form-field>