Remove temporary debug logging from formatLocalTime and HeartbeatPopup in UptimeStatusIsland
- Cleaned up console logs used for production debugging to streamline the code. - Added a log statement to indicate when UptimeStatusIsland is loaded in production. - Maintained existing functionality while improving code clarity.
This commit is contained in:
@@ -48,27 +48,22 @@ function getUptime24hBg(uptime) {
|
||||
function formatLocalTime(rawTime, zone = 'utc') {
|
||||
if (!rawTime) return '';
|
||||
|
||||
// Temporary production debug logging
|
||||
console.log('PROD DEBUG - Raw time:', rawTime, 'Zone:', zone);
|
||||
|
||||
let dt = null;
|
||||
|
||||
// First try ISO parsing (most reliable for UTC timestamps)
|
||||
try {
|
||||
dt = DateTime.fromISO(rawTime, { zone: 'utc' });
|
||||
if (dt.isValid) {
|
||||
console.log('PROD DEBUG - ISO parsing successful:', dt.toISO());
|
||||
// If target zone is UTC, return as-is
|
||||
if (zone === 'utc') {
|
||||
return dt.toFormat('dd-MM-yyyy, HH:mm:ss');
|
||||
}
|
||||
// Otherwise convert to target timezone
|
||||
const converted = dt.setZone(zone);
|
||||
console.log('PROD DEBUG - Converted to zone:', converted.toISO());
|
||||
return converted.isValid ? converted.toFormat('dd-MM-yyyy, HH:mm:ss') : 'Invalid DateTime';
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('PROD DEBUG - ISO parsing failed:', e.message);
|
||||
// Continue to format parsing if ISO fails
|
||||
}
|
||||
|
||||
// Try various formats, always assuming incoming time is UTC
|
||||
@@ -84,10 +79,7 @@ function formatLocalTime(rawTime, zone = 'utc') {
|
||||
for (const format of formats) {
|
||||
try {
|
||||
dt = DateTime.fromFormat(rawTime, format, { zone: 'utc' });
|
||||
if (dt.isValid) {
|
||||
console.log('PROD DEBUG - Format parsing successful:', format, dt.toISO());
|
||||
break;
|
||||
}
|
||||
if (dt.isValid) break;
|
||||
} catch (e) {
|
||||
continue;
|
||||
}
|
||||
@@ -99,15 +91,13 @@ function formatLocalTime(rawTime, zone = 'utc') {
|
||||
const jsDate = new Date(rawTime);
|
||||
if (!isNaN(jsDate.getTime())) {
|
||||
dt = DateTime.fromJSDate(jsDate, { zone: 'utc' });
|
||||
console.log('PROD DEBUG - JS Date parsing successful:', dt.toISO());
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('PROD DEBUG - JS Date parsing failed:', e.message);
|
||||
// Give up
|
||||
}
|
||||
}
|
||||
|
||||
if (!dt || !dt.isValid) {
|
||||
console.log('PROD DEBUG - All parsing failed for:', rawTime);
|
||||
return 'Invalid DateTime';
|
||||
}
|
||||
|
||||
@@ -121,14 +111,9 @@ function formatLocalTime(rawTime, zone = 'utc') {
|
||||
}
|
||||
|
||||
function HeartbeatPopup({ hb, userZone, monitor }) {
|
||||
// Debug logging to see what data we're receiving
|
||||
console.log('HeartbeatPopup PROD DEBUG:', { hb, userZone, hasTime: !!hb?.time });
|
||||
|
||||
const localTime = hb ? formatLocalTime(hb.time, userZone) : '';
|
||||
const utcTime = hb ? formatLocalTime(hb.time, 'utc') : '';
|
||||
|
||||
console.log('HeartbeatPopup PROD DEBUG - Results:', { localTime, utcTime });
|
||||
|
||||
return (
|
||||
<div style={{ minWidth: 220 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 4 }}>
|
||||
@@ -160,6 +145,7 @@ function HeartbeatPopup({ hb, userZone, monitor }) {
|
||||
}
|
||||
|
||||
export default function UptimeStatusIsland() {
|
||||
console.log('UptimeStatusIsland loaded in production');
|
||||
const [data, setData] = useState(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState(null);
|
||||
|
Reference in New Issue
Block a user