@@ -27,6 +27,9 @@ window.LogsModule = {
2727
2828 // Load user's timezone setting from the backend
2929 loadUserTimezone : function ( ) {
30+ // Set immediate fallback to prevent warnings during loading
31+ this . userTimezone = this . userTimezone || 'UTC' ;
32+
3033 fetch ( '/api/settings' )
3134 . then ( response => response . json ( ) )
3235 . then ( settings => {
@@ -91,17 +94,23 @@ window.LogsModule = {
9194
9295 // Convert UTC timestamp to user's timezone
9396 convertToUserTimezone : function ( utcTimestamp ) {
94- if ( ! utcTimestamp || ! this . userTimezone ) {
95- console . warn ( '[LogsModule] Missing timestamp or timezone:' , { utcTimestamp, userTimezone : this . userTimezone } ) ;
96- return { date : utcTimestamp ?. split ( ' ' ) [ 0 ] || '' , time : utcTimestamp ?. split ( ' ' ) [ 1 ] || '' } ;
97+ if ( ! utcTimestamp ) {
98+ console . debug ( '[LogsModule] No timestamp provided for conversion' ) ;
99+ return { date : '' , time : '' } ;
100+ }
101+
102+ if ( ! this . userTimezone ) {
103+ // Set fallback if timezone not loaded yet
104+ this . userTimezone = 'UTC' ;
105+ console . debug ( '[LogsModule] Timezone not loaded yet, using UTC fallback' ) ;
97106 }
98107
99108 try {
100- console . log ( '[LogsModule] Converting timestamp:' , utcTimestamp , 'from UTC to' , this . userTimezone ) ;
109+ console . debug ( '[LogsModule] Converting timestamp:' , utcTimestamp , 'from UTC to' , this . userTimezone ) ;
101110
102111 // Parse UTC timestamp - ensure it's treated as UTC
103112 const utcDate = new Date ( utcTimestamp + ' UTC' ) ;
104- console . log ( '[LogsModule] Parsed UTC date:' , utcDate . toISOString ( ) ) ;
113+ console . debug ( '[LogsModule] Parsed UTC date:' , utcDate . toISOString ( ) ) ;
105114
106115 // Convert to user's timezone using toLocaleString
107116 const userDateString = utcDate . toLocaleString ( "en-CA" , {
@@ -115,7 +124,7 @@ window.LogsModule = {
115124 hour12 : false
116125 } ) ;
117126
118- console . log ( '[LogsModule] Converted to user timezone:' , userDateString ) ;
127+ console . debug ( '[LogsModule] Converted to user timezone:' , userDateString ) ;
119128
120129 // Parse the formatted string "2025-06-05, 14:09:54"
121130 const [ datePart , timePart ] = userDateString . split ( ', ' ) ;
@@ -125,7 +134,7 @@ window.LogsModule = {
125134 time : timePart
126135 } ;
127136
128- console . log ( '[LogsModule] Final result:' , result ) ;
137+ console . debug ( '[LogsModule] Final result:' , result ) ;
129138 return result ;
130139
131140 } catch ( error ) {
0 commit comments