@@ -293,7 +293,7 @@ const userHelper = function () {
293293 // add administrative content
294294 const text = `Dear <b>${ firstName } ${ lastName } </b>,
295295 <p>Oops, it looks like something happened and you’ve managed to get a blue square.</p>
296- <p><b>Date Assigned:</b> ${ moment ( infringement . date ) . format ( 'M-D-YYYY' ) } </p>\
296+ <p><b>Date Assigned:</b> ${ moment ( new Date ( infringement . date ) ) . format ( 'M-D-YYYY' ) } </p>\
297297 <p><b>Description:</b> ${ emailDescription } </p>
298298 ${ descrInfringement }
299299 ${ finalParagraph }
@@ -1245,8 +1245,11 @@ const userHelper = function () {
12451245 const totalInfringements = newCurrent . length ;
12461246 let newInfringements = [ ] ;
12471247 let historyInfringements = 'No Previous Infringements.' ;
1248+ console . log ( 'ORIGINAL' , original ) ;
12481249 if ( original . length ) {
1249- historyInfringements = original
1250+ const sortedForHistory = [ ...original ] . sort ( ( a , b ) => new Date ( b . date ) - new Date ( a . date ) ) ;
1251+
1252+ historyInfringements = sortedForHistory
12501253 . map ( ( item , index ) => {
12511254 let enhancedDescription ;
12521255 if ( item . description ) {
@@ -1302,7 +1305,7 @@ const userHelper = function () {
13021305 enhancedDescription = `<span style="color: blue;"><b>${ item . description } </b></span>` ;
13031306 }
13041307 }
1305- return `<p>${ index + 1 } . Date: <span style="color: blue;"><b>${ moment ( item . date ) . format ( 'M-D-YYYY' ) } </b></span>, Description: ${ enhancedDescription } </p>` ;
1308+ return `<p>${ index + 1 } . Date: <span style="color: blue;"><b>${ moment ( new Date ( item . date ) ) . format ( 'M-D-YYYY' ) } </b></span>, Description: ${ enhancedDescription } </p>` ;
13061309 } )
13071310 . join ( '' ) ;
13081311 }
0 commit comments