fixed heard stations

This commit is contained in:
DJ2LS 2023-09-12 14:10:19 +02:00
parent 7bc7e155e9
commit f1b3e2937d

View file

@ -1,5 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
const {
locatorToLatLng,
distance,
bearingDistance,
latLngToLocator,
} = require("qth-locator");
import {saveSettingsToFile} from '../js/settingsHandler' import {saveSettingsToFile} from '../js/settingsHandler'
import { setActivePinia } from 'pinia'; import { setActivePinia } from 'pinia';
@ -12,6 +21,28 @@ const settings = useSettingsStore(pinia);
import { useStateStore } from '../store/stateStore.js'; import { useStateStore } from '../store/stateStore.js';
const state = useStateStore(pinia); const state = useStateStore(pinia);
function getDateTime(timestampRaw){
var datetime = new Date(timestampRaw * 1000).toLocaleString(
navigator.language,
{
hourCycle: "h23",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
},
);
return datetime
}
function getMaidenheadDistance(dxGrid){
return parseInt(distance(settings.mygrid, dxGrid));
}
</script> </script>
<template> <template>
@ -68,12 +99,12 @@ const state = useStateStore(pinia);
<tbody id="heardstations"> <tbody id="heardstations">
<!--https://vuejs.org/guide/essentials/list.html--> <!--https://vuejs.org/guide/essentials/list.html-->
<tr v-for="item in state.heard_stations" :key="item.timestamp"> <tr v-for="item in state.heard_stations" :key="item.timestamp">
<td>{{ item.timestamp }}</td> <td>{{ getDateTime(item.timestamp) }}</td>
<td>{{ item.frequency }}</td> <td>{{ item.frequency }}</td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td>{{ item.dxcallsign }}</td> <td>{{ item.dxcallsign }}</td>
<td>{{ item.dxgrid }}</td> <td>{{ item.dxgrid }}</td>
<td>{{ item.distance }}</td> <td>{{ getMaidenheadDistance(item.dxgrid)}} km</td>
<td>{{ item.datatype }}</td> <td>{{ item.datatype }}</td>
<td>{{ item.snr }}</td> <td>{{ item.snr }}</td>
<!--<td>{{ item.offset }}</td>--> <!--<td>{{ item.offset }}</td>-->