Skip to content

Commit 70ef93b

Browse files
committed
Adding date-formatter. Changing | date:' ' to date-formatter component-
1 parent 06c4954 commit 70ef93b

File tree

21 files changed

+100
-23
lines changed

21 files changed

+100
-23
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export class DateFormatterModel {
2+
date: Date;
3+
time: Date;
4+
}

eform-client/src/app/common/models/common/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './common-dictionary.model';
33
export * from './key-value.model';
44
export * from './common-dictionary-text.model';
55
export * from './status-bar.model';
6+
export * from './date-formatter.model';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div *ngIf="format == 'date'">
2+
{{dateFormatter.date | date : 'dd.MM.y'}}
3+
</div>
4+
<div *ngIf="format == 'time'">
5+
{{dateFormatter.date | date : 'HH:mm:ss'}}
6+
</div>
7+
<div *ngIf="format == 'datetime'">
8+
{{dateFormatter.date | date : 'dd.MM.y HH:mm:ss'}}
9+
</div>

eform-client/src/app/common/modules/eform-shared/components/date-formatter/date-formatter.component.scss

Whitespace-only changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { Component, OnInit, Input } from '@angular/core';
2+
import { DateFormatterModel} from '../../../../models/common';
3+
import {formatDate} from '@angular/common';
4+
5+
@Component({
6+
selector: 'date-formatter',
7+
templateUrl: './date-formatter.component.html',
8+
styleUrls: ['./date-formatter.component.scss']
9+
})
10+
export class DateFormatterComponent implements OnInit {
11+
dateFormatter: DateFormatterModel = new DateFormatterModel();
12+
format: string;
13+
constructor() { }
14+
15+
@Input()
16+
get date() {
17+
return this.dateFormatter.date;
18+
}
19+
set date(format) {
20+
this.dateFormatter.date = format;
21+
}
22+
@Input()
23+
get Format() {
24+
return this.format;
25+
}
26+
set Format(format) {
27+
this.format = format;
28+
}
29+
ngOnInit() {
30+
}
31+
32+
}

eform-client/src/app/common/modules/eform-shared/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './eform-pagination/eform-pagination.component';
33
export * from './eform-spinner/eform-spinner.component';
44
export * from './eform-page-size/eform-page-size.component';
55
export * from './status-bar/status-bar.component';
6+
export * from './date-formatter/date-formatter.component';

eform-client/src/app/common/modules/eform-shared/eform-shared.module.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
EformPaginationComponent,
1010
EformSpinnerComponent,
1111
EformPageSizeComponent,
12-
StatusBarComponent
13-
} from './components';
12+
StatusBarComponent,
13+
DateFormatterComponent} from './components';
1414

1515
@NgModule({
1616
imports: [
@@ -24,14 +24,16 @@ import {
2424
EformPaginationComponent,
2525
EformSpinnerComponent,
2626
EformPageSizeComponent,
27-
StatusBarComponent
27+
StatusBarComponent,
28+
DateFormatterComponent
2829
],
2930
exports: [
3031
EformPageSubheaderComponent,
3132
EformPaginationComponent,
3233
EformSpinnerComponent,
3334
EformPageSizeComponent,
34-
StatusBarComponent
35+
StatusBarComponent,
36+
DateFormatterComponent
3537
]
3638
})
3739
export class EformSharedModule {

eform-client/src/app/modules/advanced/components/entity-search/entity-search-remove/entity-search-remove.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ <h6><strong>{{selectedGroupModel.microtingUUID}}</strong></h6>
1919
<h6>{{'Creation date' | translate}}</h6>
2020
</div>
2121
<div class="col-md-6">
22-
<h6><strong>{{selectedGroupModel.createdAt | date:'dd.MM.y HH:mm:ss'}}</strong></h6>
22+
<h6><strong>
23+
<date-formatter [date]="selectedGroupModel.createdAt" [Format]="'datetime'"></date-formatter>
24+
</strong></h6>
2325
</div>
2426
</div>
2527
<div class="row">

eform-client/src/app/modules/advanced/components/entity-select/entity-select-remove/entity-select-remove.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ <h6><strong>{{selectedGroupModel.microtingUUID}}</strong></h6>
1919
<h6>{{'Creation date' | translate}}</h6>
2020
</div>
2121
<div class="col-md-6">
22-
<h6><strong>{{selectedGroupModel.createdAt | date:'dd.MM.y HH:mm:ss'}}</strong></h6>
22+
<h6><strong>
23+
<date-formatter [date]="selectedGroupModel.createdAt" [Format]="'datetime'"></date-formatter>
24+
</strong></h6>
2325
</div>
2426
</div>
2527
<div class="row">

eform-client/src/app/modules/advanced/components/sites/site-delete/site-delete.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h6>{{siteNameDto.siteUId}}</h6>
2020
<h6>{{'Creation Date' | translate}}</h6>
2121
</div>
2222
<div class="col-md-6">
23-
{{siteNameDto.createdAt | date:'dd.MM.y HH:mm:ss'}}
23+
<date-formatter [date]="siteNameDto.createdAt" [Format]="'datetime'"></date-formatter>
2424
</div>
2525
</div>
2626

0 commit comments

Comments
 (0)