Skip to content

Commit

Permalink
Station: better start/end
Browse files Browse the repository at this point in the history
  • Loading branch information
simon04 committed Apr 18, 2024
1 parent 833d27a commit 94fc8e2
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/components/Station.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,17 @@ const props = defineProps<{
parameters: ParameterMetadataModel[];
}>();
const startOfYesterday = new Date();
startOfYesterday.setDate(startOfYesterday.getDate() - 1);
startOfYesterday.setHours(0, 0, 0, 0);
const startOfTomorrow = new Date();
startOfTomorrow.setDate(startOfTomorrow.getDate() + 1);
startOfTomorrow.setHours(0, 0, 0, 0);
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
const params = useUrlSearchParams("history");
params.parameter ||=
props.parameters.find((p) => ["TL", "TTX", "T", "t"].includes(p.name))
?.name || [];
params.start ||= startOfYesterday.toISOString().slice(0, "2006-01-02".length);
params.end ||= startOfTomorrow.toISOString().slice(0, "2006-01-02".length);
params.start ||= yesterday.toISOString().slice(0, "2006-01-02".length);
params.end ||= tomorrow.toISOString().slice(0, "2006-01-02".length);
const stations = computed({
get: () =>
Expand Down

0 comments on commit 94fc8e2

Please sign in to comment.