Skip to content

Commit

Permalink
Convert the time to usertzdate (#1151)
Browse files Browse the repository at this point in the history
**Related Ticket:**
US-GHG-Center/ghgc-architecture#235

### Description of Changes
Because Javascript Date object outputs the local time of the computer,
the output of the date was converted to earlier time than the value we
got from the search result.
ex. search result value: `"2023-12-01T00:00:00+00:00"`
output date value (on my computer) ( new Date(
"2023-12-01T00:00:00+00:00")) `Thu Nov 30 2023 19:00:00 GMT-0500
(Eastern Standard Time)`

### Notes & Questions About Changes
  • Loading branch information
hanbyul-here authored Sep 13, 2024
2 parents fe91ed7 + d107ec9 commit cecafa7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/scripts/components/exploration/analysis-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
DatasetStatus
} from './types.d.ts';
import { ExtendedError } from './data-utils';
import { utcString2userTzDate } from '$utils/date';
import {
fixAoiFcForStacSearch,
getFilterPayload
Expand Down Expand Up @@ -58,10 +59,9 @@ async function getDatasetAssets(
},
opts
);

return {
assets: searchReqRes.data.features.map((o) => ({
date: new Date(o.properties.start_datetime || o.properties.datetime),
date: utcString2userTzDate(o.properties.start_datetime || o.properties.datetime),
url: o.assets[assets].href
}))
};
Expand Down Expand Up @@ -218,6 +218,7 @@ export async function requestDatasetTimeseriesData({
);
}
);

onProgress({
status: DatasetStatus.LOADING,
error: null,
Expand Down

0 comments on commit cecafa7

Please sign in to comment.