fix NaN hour bug

pull/27/head
accius 4 days ago
parent 5b8827e729
commit 4ea71af1e8

@ -92,7 +92,7 @@ RXGOS 0.0
AntennaOrientation "TX2RX" AntennaOrientation "TX2RX"
Path.year ${year} Path.year ${year}
Path.month ${month} Path.month ${month}
Path.hour ${hour === 0 ? 24 : hour} Path.hour ${isNaN(hour) ? 12 : (hour === 0 ? 24 : hour)}
Path.SSN ${ssn} Path.SSN ${ssn}
Path.frequency ${freqList} Path.frequency ${freqList}
Path.txpower ${(10 * Math.log10(txPower / 1000)).toFixed(1)} Path.txpower ${(10 * Math.log10(txPower / 1000)).toFixed(1)}
@ -500,7 +500,7 @@ app.get('/api/predict', async (req, res) => {
rxLon: parseFloat(rxLon), rxLon: parseFloat(rxLon),
year: parseInt(year), year: parseInt(year),
month: parseInt(month) || new Date().getMonth() + 1, month: parseInt(month) || new Date().getMonth() + 1,
hour: parseInt(hour) || new Date().getUTCHours(), hour: parseInt(hour) || new Date().getUTCHours() || 12,
ssn: parseInt(ssn) || 100, ssn: parseInt(ssn) || 100,
txPower: parseInt(txPower) || 100 txPower: parseInt(txPower) || 100
}; };
@ -613,7 +613,7 @@ app.get('/api/bands', async (req, res) => {
rxLon: parseFloat(rxLon), rxLon: parseFloat(rxLon),
year: new Date().getFullYear(), year: new Date().getFullYear(),
month: parseInt(month) || new Date().getMonth() + 1, month: parseInt(month) || new Date().getMonth() + 1,
hour: parseInt(hour) ?? new Date().getUTCHours(), hour: parseInt(hour) || new Date().getUTCHours() || 12,
ssn: parseInt(ssn) || 100, ssn: parseInt(ssn) || 100,
frequencies: Object.values(HF_BANDS) frequencies: Object.values(HF_BANDS)
}; };

Loading…
Cancel
Save

Powered by TurnKey Linux.