Skip to content

Commit d4363dd

Browse files
Update datetime-picker README
added workaround for locale specified in issue h2qutc#173
1 parent e1eee73 commit d4363dd

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

projects/datetime-picker/README.md

+17-8
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ npm install --save @angular-material-components/datetime-picker
4343
## Setup
4444
Basically the same way the @angular/material Datepicker is configured and imported.
4545

46-
```
46+
```typescript
4747
import { NgxMatDatetimePickerModule, NgxMatTimepickerModule } from '@angular-material-components/datetime-picker';
4848
@NgModule({
4949
...
@@ -71,7 +71,7 @@ The same API as @angular/material Datepicker (@see [API docs](https://material.a
7171

7272
### Datetime Picker (ngx-mat-datetime-picker)
7373

74-
```
74+
```html
7575
<mat-form-field>
7676
<input matInput [ngxMatDatetimePicker]="picker" placeholder="Choose a date" [formControl]="dateControl"
7777
[min]="minDate" [max]="maxDate" [disabled]="disabled">
@@ -86,7 +86,7 @@ The same API as @angular/material Datepicker (@see [API docs](https://material.a
8686

8787
### Timepicker (ngx-mat-timepicker)
8888

89-
```
89+
```html
9090
<ngx-mat-timepicker [(ngModel)]="date"></ngx-mat-timepicker>
9191
<ngx-mat-timepicker [(ngModel)]="date" [disabled]="disabled"></ngx-mat-timepicker>
9292
<ngx-mat-timepicker [(ngModel)]="date" [stepHour]="2" [stepMinute]="5" [stepSecond]="10"></ngx-mat-timepicker>
@@ -142,14 +142,14 @@ For example:
142142

143143
Creating a custom date adapter:
144144

145-
```
145+
```typescript
146146
@Injectable()
147147
export class CustomDateAdapter extends NgxMatDateAdapter<D> {...}
148148
// D can be Date, Moment or customized type
149149
```
150150

151151
Creating a custom date adapter module
152-
```
152+
```typescript
153153
@NgModule({
154154
providers: [
155155
{
@@ -164,7 +164,7 @@ export class CustomDateModule { }
164164

165165
You can also customize the date format by providing your custom NGX_MAT_DATE_FORMATS in your module.
166166

167-
```
167+
```typescript
168168
// If using Moment
169169
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
170170
parse: {
@@ -183,13 +183,22 @@ providers: [
183183
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_MOMENT_FORMATS }
184184
]
185185
```
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+
```
186195

187196
## Theming
188197
- @see @angular/material [Using a pre-built theme](https://material.angular.io/guide/theming#using-a-pre-built-theme)
189198
- Add the Material Design icon font to your index.html
190-
```
199+
```html
191200
<link href="https://fonts.googleapis.com/icon?family=Material+Icons&display=block" rel="stylesheet">
192201
```
193202

194203
## License
195-
MIT
204+
MIT

0 commit comments

Comments
 (0)