diff --git a/src-ui/src/app/app.module.ts b/src-ui/src/app/app.module.ts
index 9e0dc56de..46d8df9a1 100644
--- a/src-ui/src/app/app.module.ts
+++ b/src-ui/src/app/app.module.ts
@@ -60,7 +60,7 @@ import { NumberComponent } from './components/common/input/number/number.compone
import { SafePipe } from './pipes/safe.pipe';
import { CustomDatePipe } from './pipes/custom-date.pipe';
import { DateComponent } from './components/common/input/date/date.component';
-import { ISODateAdapter } from './utils/ngb-date-adapter';
+import { ISODateTimeAdapter } from './utils/ngb-iso-date-time-adapter';
import { LocalizedDateParserFormatter } from './utils/ngb-date-parser-formatter';
import localeFr from '@angular/common/locales/fr';
@@ -147,7 +147,7 @@ registerLocaleData(localeEnGb)
},
FilterPipe,
DocumentTitlePipe,
- {provide: NgbDateAdapter, useClass: ISODateAdapter},
+ {provide: NgbDateAdapter, useClass: ISODateTimeAdapter},
{provide: NgbDateParserFormatter, useClass: LocalizedDateParserFormatter}
],
bootstrap: [AppComponent]
diff --git a/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html b/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html
index b70a04103..ee8e6e6f4 100644
--- a/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html
+++ b/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html
@@ -20,8 +20,17 @@
+
@@ -36,8 +45,17 @@
+
diff --git a/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.ts b/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.ts
index 27472bdc7..e21b28312 100644
--- a/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.ts
+++ b/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.ts
@@ -1,7 +1,10 @@
import { formatDate } from '@angular/common';
import { Component, EventEmitter, Input, Output, OnInit, OnDestroy } from '@angular/core';
+import { NgbDateAdapter } from '@ng-bootstrap/ng-bootstrap';
import { Subject, Subscription } from 'rxjs';
-import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
+import { debounceTime } from 'rxjs/operators';
+import { SettingsService } from 'src/app/services/settings.service';
+import { ISODateAdapter } from 'src/app/utils/ngb-iso-date-adapter';
export interface DateSelection {
before?: string
@@ -16,10 +19,17 @@ const LAST_YEAR = 3
@Component({
selector: 'app-date-dropdown',
templateUrl: './date-dropdown.component.html',
- styleUrls: ['./date-dropdown.component.scss']
+ styleUrls: ['./date-dropdown.component.scss'],
+ providers: [
+ {provide: NgbDateAdapter, useClass: ISODateAdapter},
+ ]
})
export class DateDropdownComponent implements OnInit, OnDestroy {
+ constructor(settings: SettingsService) {
+ this.datePlaceHolder = settings.getLocalizedDateInputFormat()
+ }
+
quickFilters = [
{id: LAST_7_DAYS, name: $localize`Last 7 days`},
{id: LAST_MONTH, name: $localize`Last month`},
@@ -27,6 +37,8 @@ export class DateDropdownComponent implements OnInit, OnDestroy {
{id: LAST_YEAR, name: $localize`Last year`}
]
+ datePlaceHolder: string
+
@Input()
dateBefore: string
diff --git a/src-ui/src/app/utils/ngb-iso-date-adapter.ts b/src-ui/src/app/utils/ngb-iso-date-adapter.ts
new file mode 100644
index 000000000..e43602a16
--- /dev/null
+++ b/src-ui/src/app/utils/ngb-iso-date-adapter.ts
@@ -0,0 +1,27 @@
+import { Injectable } from "@angular/core";
+import { NgbDateAdapter, NgbDateStruct } from "@ng-bootstrap/ng-bootstrap";
+
+@Injectable()
+export class ISODateAdapter extends NgbDateAdapter {
+
+ fromModel(value: string | null): NgbDateStruct | null {
+ if (value) {
+ let date = new Date(value)
+ return {
+ day : date.getDate(),
+ month : date.getMonth() + 1,
+ year : date.getFullYear()
+ }
+ } else {
+ return null
+ }
+ }
+
+ toModel(date: NgbDateStruct | null): string | null {
+ if (date) {
+ return date.year.toString().padStart(4, '0') + "-" + date.month.toString().padStart(2, '0') + "-" + date.day.toString().padStart(2, '0')
+ } else {
+ return null
+ }
+ }
+}
diff --git a/src-ui/src/app/utils/ngb-date-adapter.ts b/src-ui/src/app/utils/ngb-iso-date-time-adapter.ts
similarity index 89%
rename from src-ui/src/app/utils/ngb-date-adapter.ts
rename to src-ui/src/app/utils/ngb-iso-date-time-adapter.ts
index 19711319d..21a97a19a 100644
--- a/src-ui/src/app/utils/ngb-date-adapter.ts
+++ b/src-ui/src/app/utils/ngb-iso-date-time-adapter.ts
@@ -2,7 +2,7 @@ import { Injectable } from "@angular/core";
import { NgbDateAdapter, NgbDateStruct } from "@ng-bootstrap/ng-bootstrap";
@Injectable()
-export class ISODateAdapter extends NgbDateAdapter {
+export class ISODateTimeAdapter extends NgbDateAdapter {
fromModel(value: string | null): NgbDateStruct | null {
if (value) {