Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix on filter not using basic datepicker

Oliver Güntherdd827ddcd956
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html
index d4ee0352b6f..5226c44b67e 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html
+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html
@@ -1,9 +1,9 @@
-<op-single-date-picker
+<op-basic-single-date-picker
[id]="'values-' + filter.id"
[name]="'v[' + filter.id + ']'"
class="advanced-filters--date-field"
[opAutofocus]="shouldFocus"
- (changed)="value = parser($event)"
+ (valueChange)="valueChanged($event)"
[value]="formatter(value)"
[required]="true"
-></op-single-date-picker>
+></op-basic-single-date-picker>
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.ts b/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.ts
index a3bba151b3c..d6d533e7108 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.ts
+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.ts
@@ -55,23 +55,30 @@ export class FilterDateValueComponent extends UntilDestroyedMixin {
super();
}
- public get value():HalResource|string {
- return this.filter.values[0];
+ public get value():string {
+ return this.filter.values[0] as string;
}
public set value(val) {
- this.filter.values = [val as string];
+ this.filter.values = [val];
this.filterChanged.emit(this.filter);
}
- public parser(data:any) {
+ valueChanged(val:string) {
+ const parsed = this.parser(val);
+ if (parsed) {
+ this.value = val;
+ }
+ }
+
+ public parser(data:string) {
if (moment(data, 'YYYY-MM-DD', true).isValid()) {
return data;
}
return null;
}
- public formatter(data:any) {
+ public formatter(data:string) {
if (moment(data, 'YYYY-MM-DD', true).isValid()) {
const d = this.timezoneService.parseDate(data);
return this.timezoneService.formattedISODate(d);