Skip to content

Commit 7b20e90

Browse files
committed
add locale demo
1 parent fd4f950 commit 7b20e90

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

Diff for: demo/src/app/app.component.html

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<div class="nav-wrapper container">
1010
<ul class="left hide-on-small-only">
1111
<li routerLinkActive="active"><a [routerLink]="['simple']">Simple</a></li>
12+
<li routerLinkActive="active"><a [routerLink]="['locale']">Locale</a></li>
1213
<li routerLinkActive="active"><a [routerLink]="['single-datepicker']">Single datepicker (fr)</a></li>
1314
<li routerLinkActive="active"><a [routerLink]="['reactive-forms']">Reactive forms</a></li>
1415
<li routerLinkActive="active"><a [routerLink]="['with-timepicker']">With timepicker</a></li>

Diff for: demo/src/app/app.module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ import { CustomRangesComponent } from './custom-ranges/custom-ranges.component';
2121
import { TimepickerComponent } from './timepicker/timepicker.component';
2222
import { ReactiveFormComponent } from './reactive-form/reactive-form.component';
2323
import { MatOptionModule } from '@angular/material/core';
24+
import { LocaleComponent } from './locale/locale.component';
2425

2526
@NgModule({
2627
declarations: [
2728
AppComponent,
2829
SimpleComponent,
30+
LocaleComponent,
2931
FullComponent,
3032
SingleDatepickerComponent,
3133
CustomRangesComponent,

Diff for: demo/src/app/app.routing.ts

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CustomRangesComponent } from './custom-ranges/custom-ranges.component';
55
import { SingleDatepickerComponent } from './single-datepicker/single-datepicker.component';
66
import { TimepickerComponent } from './timepicker/timepicker.component';
77
import { ReactiveFormComponent } from './reactive-form/reactive-form.component';
8+
import { LocaleComponent } from './locale/locale.component';
89

910
export const appRoutes: Routes = [
1011
{
@@ -16,6 +17,10 @@ export const appRoutes: Routes = [
1617
path: 'simple',
1718
component: SimpleComponent
1819
},
20+
{
21+
path: 'locale',
22+
component: LocaleComponent
23+
},
1924
{
2025
path: 'single-datepicker',
2126
component: SingleDatepickerComponent

Diff for: demo/src/app/locale/locale.component.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<mat-toolbar>Locale daterangepicker</mat-toolbar>
2+
<div class="row">
3+
<div class="col s6">
4+
<input
5+
type="text"
6+
ngxDaterangepickerMd
7+
[(ngModel)]="selected"
8+
class="form-control"
9+
placeholder="Choose date"
10+
[locale]="{ locale, applyLabel: 'Ack' }" />
11+
</div>
12+
<div class="col s6 right-align">
13+
<select>
14+
<option value="fr">French</option>
15+
<option value="en">English</option>
16+
</select>
17+
</div>
18+
</div>

Diff for: demo/src/app/locale/locale.component.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as fr from 'dayjs/locale/fr'
2+
import { Component, OnInit, ViewChild } from '@angular/core';
3+
import dayjs from 'dayjs/esm';
4+
dayjs.locale(fr);
5+
import utc from 'dayjs/esm/plugin/utc';
6+
dayjs.extend(utc);
7+
8+
@Component({
9+
// eslint-disable-next-line @angular-eslint/component-selector
10+
selector: 'locale',
11+
templateUrl: './locale.component.html'
12+
})
13+
export class LocaleComponent implements OnInit {
14+
selected: { startDate: dayjs.Dayjs; endDate: dayjs.Dayjs };
15+
locale = fr;
16+
constructor() {}
17+
18+
ngOnInit(): void {}
19+
}

0 commit comments

Comments
 (0)