From d4363dd21984a226fe4248083ad19a7730c86e8c Mon Sep 17 00:00:00 2001 From: frostedpenguin Date: Wed, 25 Oct 2023 15:33:03 +0300 Subject: [PATCH] Update datetime-picker README added workaround for locale specified in issue #173 --- projects/datetime-picker/README.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/projects/datetime-picker/README.md b/projects/datetime-picker/README.md index 3cd32fac..82d4a042 100644 --- a/projects/datetime-picker/README.md +++ b/projects/datetime-picker/README.md @@ -43,7 +43,7 @@ npm install --save @angular-material-components/datetime-picker ## Setup Basically the same way the @angular/material Datepicker is configured and imported. -``` +```typescript import { NgxMatDatetimePickerModule, NgxMatTimepickerModule } from '@angular-material-components/datetime-picker'; @NgModule({ ... @@ -71,7 +71,7 @@ The same API as @angular/material Datepicker (@see [API docs](https://material.a ### Datetime Picker (ngx-mat-datetime-picker) -``` +```html @@ -86,7 +86,7 @@ The same API as @angular/material Datepicker (@see [API docs](https://material.a ### Timepicker (ngx-mat-timepicker) -``` +```html @@ -142,14 +142,14 @@ For example: Creating a custom date adapter: -``` +```typescript @Injectable() export class CustomDateAdapter extends NgxMatDateAdapter {...} // D can be Date, Moment or customized type ``` Creating a custom date adapter module -``` +```typescript @NgModule({ providers: [ { @@ -164,7 +164,7 @@ export class CustomDateModule { } You can also customize the date format by providing your custom NGX_MAT_DATE_FORMATS in your module. -``` +```typescript // If using Moment const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { parse: { @@ -183,13 +183,22 @@ providers: [ { provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_MOMENT_FORMATS } ] ``` +in case you want to use a country locale you can use the code below + +```typescript + constructor ( + private adapter: NgxMatDateAdapter + ) { + this.adapter.setLocale("el-GR"); + } +``` ## Theming - @see @angular/material [Using a pre-built theme](https://material.angular.io/guide/theming#using-a-pre-built-theme) - Add the Material Design icon font to your index.html -``` +```html ``` ## License -MIT \ No newline at end of file +MIT