@@ -43,7 +43,7 @@ npm install --save @angular-material-components/datetime-picker
43
43
## Setup
44
44
Basically the same way the @angular/material Datepicker is configured and imported.
45
45
46
- ```
46
+ ``` typescript
47
47
import { NgxMatDatetimePickerModule , NgxMatTimepickerModule } from ' @angular-material-components/datetime-picker' ;
48
48
@NgModule ({
49
49
...
@@ -71,7 +71,7 @@ The same API as @angular/material Datepicker (@see [API docs](https://material.a
71
71
72
72
### Datetime Picker (ngx-mat-datetime-picker)
73
73
74
- ```
74
+ ``` html
75
75
<mat-form-field >
76
76
<input matInput [ngxMatDatetimePicker] =" picker" placeholder =" Choose a date" [formControl] =" dateControl"
77
77
[min] =" minDate" [max] =" maxDate" [disabled] =" disabled" >
@@ -86,7 +86,7 @@ The same API as @angular/material Datepicker (@see [API docs](https://material.a
86
86
87
87
### Timepicker (ngx-mat-timepicker)
88
88
89
- ```
89
+ ``` html
90
90
<ngx-mat-timepicker [(ngModel)] =" date" ></ngx-mat-timepicker >
91
91
<ngx-mat-timepicker [(ngModel)] =" date" [disabled] =" disabled" ></ngx-mat-timepicker >
92
92
<ngx-mat-timepicker [(ngModel)] =" date" [stepHour] =" 2" [stepMinute] =" 5" [stepSecond] =" 10" ></ngx-mat-timepicker >
@@ -142,14 +142,14 @@ For example:
142
142
143
143
Creating a custom date adapter:
144
144
145
- ```
145
+ ``` typescript
146
146
@Injectable ()
147
147
export class CustomDateAdapter extends NgxMatDateAdapter <D > {... }
148
148
// D can be Date, Moment or customized type
149
149
```
150
150
151
151
Creating a custom date adapter module
152
- ```
152
+ ``` typescript
153
153
@NgModule ({
154
154
providers: [
155
155
{
@@ -164,7 +164,7 @@ export class CustomDateModule { }
164
164
165
165
You can also customize the date format by providing your custom NGX_MAT_DATE_FORMATS in your module.
166
166
167
- ```
167
+ ``` typescript
168
168
// If using Moment
169
169
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
170
170
parse: {
@@ -183,13 +183,22 @@ providers: [
183
183
{ provide: NGX_MAT_DATE_FORMATS , useValue: CUSTOM_MOMENT_FORMATS }
184
184
]
185
185
```
186
+ in case you want to use a country locale you can use the code below
187
+
188
+ ``` typescript
189
+ constructor (
190
+ private adapter : NgxMatDateAdapter < Date >
191
+ ) {
192
+ this .adapter .setLocale (" el-GR" );
193
+ }
194
+ ```
186
195
187
196
## Theming
188
197
- @see @angular/material [ Using a pre-built theme] ( https://material.angular.io/guide/theming#using-a-pre-built-theme )
189
198
- Add the Material Design icon font to your index.html
190
- ```
199
+ ``` html
191
200
<link href =" https://fonts.googleapis.com/icon?family=Material+Icons&display=block" rel =" stylesheet" >
192
201
```
193
202
194
203
## License
195
- MIT
204
+ MIT
0 commit comments