Skip to content

Commit

Permalink
fix(geo): fix ogc date format
Browse files Browse the repository at this point in the history
(cherry picked from commit 0c02bb63696a06e105c689f1fc9a8b232aaca7e1)
  • Loading branch information
aziz-access authored and alecarn committed Feb 11, 2025
1 parent 2cf4001 commit 51c93fb
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ export class OgcFilterTimeComponent implements OnInit {
refreshFilter = true
) {
if (typeof value === 'string') {
if (!this.isValidDate(value)) {
return;
}
value = new Date(value);
}
let valueTmp = this.getDateTime(value, position);
Expand Down Expand Up @@ -788,4 +791,12 @@ export class OgcFilterTimeComponent implements OnInit {
this.setFilterStateDisable();
this.updateValues();
}

private isValidDate(value: string): boolean {
if (/^\d+$/.test(value)) {
return false;
}
const date = new Date(value);
return date instanceof Date && !isNaN(date.getTime());
}
}

0 comments on commit 51c93fb

Please sign in to comment.