Skip to content

Commit

Permalink
fix default value data for spatiotemporal layer
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurmarakana89 committed Feb 21, 2024
1 parent 60fe467 commit 60222fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"locked": true,
"reversed": true,
"defaultValue": "2024-02-20T15:48:00Z"
"defaultValue": "2024-02-21T12:54:00Z"
},
{
"layerPaths": ["MSI/msi-94-or-more"],
Expand Down
6 changes: 4 additions & 2 deletions packages/geoview-time-slider/src/time-slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ export function TimeSlider(TimeSliderPanelProps: TimeSliderPanelProps) {
const defaultValueIsArray = Array.isArray(sliderConfig?.defaultValue);
if (defaultValueIsArray) {
setValues(layerPath, [new Date(sliderConfig?.defaultValue[0]).getTime(), new Date(sliderConfig?.defaultValue[1]).getTime()]);
} else {
} else if (range.includes(sliderConfig?.defaultValue)) {
setValues(layerPath, [new Date(sliderConfig?.defaultValue).getTime()]);
} else {
setValues(layerPath, [new Date(range[0]).getTime()]);
}
}
}, [config, layerPath, setValues]);
}, [config, layerPath, range, setValues]);

const timeStampRange = range.map((entry: string | number | Date) => new Date(entry).getTime());
// Check if range occurs in a single day or year
Expand Down

0 comments on commit 60222fd

Please sign in to comment.