diff --git a/src/legacyCompat.ts b/src/legacyCompat.ts index 6b568565..258f3deb 100644 --- a/src/legacyCompat.ts +++ b/src/legacyCompat.ts @@ -304,6 +304,9 @@ function bboxFromParams(service: ServiceType, version: string, crsAuthId: CRS_ID default: throw new Error('Unsupported CRS - bbox could not be parsed'); } + // SH services support switched min & max X/Y, but we don't: + [minX, maxX] = [Math.min(minX, maxX), Math.max(minX, maxX)]; + [minY, maxY] = [Math.min(minY, maxY), Math.max(minY, maxY)]; return new BBox(crs, minX, minY, maxX, maxY); } @@ -337,7 +340,7 @@ function timeFromParams(params: any): Date[] { fromTime = new Date(timeParts[0]); toTime = new Date(timeParts[1]); if (!isTimeSpecifiedInDate(timeParts[1])) { - toTime.setHours(23, 59, 59, 999); + toTime.setUTCHours(23, 59, 59, 999); } } else if (timeParts.length === 1) { // "When a single time is specified the service will return data from beginning of @@ -345,7 +348,7 @@ function timeFromParams(params: any): Date[] { fromTime = new Date('1970-01-01'); toTime = new Date(timeParts[0]); if (!isTimeSpecifiedInDate(timeParts[0])) { - toTime.setHours(23, 59, 59, 999); + toTime.setUTCHours(23, 59, 59, 999); } }