Update package-lock.json and enhance UptimeStatusIsland component for time formatting
- Updated package-lock.json to reflect new versions of dependencies, including luxon for date handling. - Modified UptimeStatusIsland component to improve local time formatting, ensuring UTC display and handling of invalid dates.
This commit is contained in:
@@ -44,11 +44,12 @@ function getUptime24hBg(uptime) {
|
||||
return 'bg-red-600 text-white dark:bg-red-800 dark:text-white';
|
||||
}
|
||||
|
||||
function formatLocalTime(utcTime) {
|
||||
if (!utcTime) return '';
|
||||
const dt = DateTime.fromISO(utcTime, { zone: 'utc' });
|
||||
function formatLocalTime(rawTime) {
|
||||
if (!rawTime) return '';
|
||||
// Parse the API's custom format as UTC
|
||||
const dt = DateTime.fromFormat(rawTime, 'yyyy-MM-dd HH:mm:ss.SSS', { zone: 'utc' });
|
||||
// Always show in UTC, format: dd-MM-yyyy, HH:mm:ss UTC
|
||||
return dt.toFormat('dd-MM-yyyy, HH:mm:ss') + ' UTC';
|
||||
return dt.isValid ? dt.toFormat('dd-MM-yyyy, HH:mm:ss') + ' UTC' : 'Invalid DateTime UTC';
|
||||
}
|
||||
|
||||
export default function UptimeStatusIsland() {
|
||||
|
Reference in New Issue
Block a user