@@ -88,7 +88,7 @@ public function ajax_handle_errors() {
8888 return ;
8989 }
9090 $ log_file_valid = $ this ->is_file_valid ();
91- if ( true !== $ log_file_valid ) {
91+ if ( ! $ log_file_valid ) {
9292 $ this ->ajax_header ();
9393 echo $ log_file_valid ;
9494 die ();
@@ -179,11 +179,10 @@ public function replace_callback( $arr ) {
179179 } else { // we already have that error...
180180 $ this ->content [ $ err_id ]['cnt ' ]++; // counter.
181181 }
182- $ time = preg_replace ( '/-[0-9]{4}/ ' , '' , $ arr [1 ] ); // strip year.
183- $ time = preg_replace ( '/:[0-9]{2} .*/ ' , '' , $ time ); // strip seconds + timezone.
184- $ this ->content [ $ err_id ]['time ' ] = $ time ; // time.
185182
186- $ message = htmlspecialchars ( trim ( $ arr [2 ] ), ENT_QUOTES );
183+ $ date = date_create ( $ arr [1 ] ); // false if no valid date.
184+ $ this ->content [ $ err_id ]['time ' ] = $ date ? $ date ->format ( DateTime::ATOM ) : $ arr [1 ]; // ISO8601, readable in js
185+ $ message = htmlspecialchars ( trim ( $ arr [2 ] ), ENT_QUOTES );
187186 $ this ->content [ $ err_id ]['msg ' ] = $ this ->settings ['vscode_links ' ] ? $ this ->link_vscode_files ( $ message ) : $ message ;
188187 $ this ->content [ $ err_id ]['cls ' ] = implode (
189188 ' ' ,
@@ -193,7 +192,6 @@ public function replace_callback( $arr ) {
193192 2
194193 )
195194 ); // the first few words of the message become class items.
196-
197195 }
198196
199197 public function delete () {
@@ -292,10 +290,10 @@ public function ajax_filesize() {
292290 :md-description="`The file has a size of ${ readableFilesize() }`">
293291 </md-table-empty-state>
294292 <md-table-row slot="md-table-row" slot-scope="{ item }">
295- <!-- <md-table-cell md-label="ID" md-sort-by="id" md-numeric>{{ item.id }}</md-table-cell> -->
296293 <md-table-cell :error="item.cls" md-label="Count" md-sort-by="cnt">{{ item.cnt }}</md-table-cell>
297- <md-table-cell :error="item.cls" style="min-width:140px" md-label="Time" md-sort-by="time">{{ item.time }}</md-table-cell>
298- <!-- <md-table-cell :error="item.cls" md-label="cls" md-sort-by="cls">{{ item.cls }}</md-table-cell> -->
294+ <md-table-cell :error="item.cls" style="min-width:140px" md-label="Time" md-sort-by="time">
295+ <time :datetime="item.time">{{ readableDateTime(item.time) }}</time>
296+ </md-table-cell>
299297 <md-table-cell class="message" md-label="Message" md-sort-by="msg" ><pre v-html="item.msg">{{ item.msg }}</pre></md-table-cell>
300298 </md-table-row>
301299 </md-table>
@@ -344,6 +342,10 @@ public function ajax_filesize() {
344342 }
345343
346344 },
345+ readableDateTime( dateTimeString ){
346+ let date = new Date(dateTimeString);
347+ return isNaN( date ) ? dateTimeString : date.toLocaleString();
348+ },
347349 searchOnTable () {
348350 if ( this.search == "" ){
349351 this.searched = this.entries
0 commit comments