@@ -153,18 +153,18 @@ export function tooltipText(
153153
154154 if ( observation_value_error === null && age_error === null ) {
155155 // sds in square brackets
156-
156+ const formatted_observation_date = new Date ( observation_date ) . toLocaleDateString ( "en-GB" , { year : "numeric" , month : "short" , day : "numeric" } ) ;
157157 const sds_string = `[SDS: ${ sds > 0 ? '+' + Math . round ( sds * 1000 ) / 1000 : Math . round ( sds * 1000 ) / 1000 } ]` ;
158158 if ( age_type === 'corrected_age' && x > 0.0383 ) {
159159 const finalCorrectedString = comment . replaceAll ( ', ' , ',\n' ) . replaceAll ( '. ' , '.\n' ) ;
160- return `Corrected age: ${ calendar_age } on ${ observation_date } \n${ finalCorrectedString } \n${ y } ${ measurementSuffix ( measurementMethod ) } ${ clinicianFocus ? sds_string : '\n' + finalCentile } ` ;
160+ return `Corrected age: ${ calendar_age } on ${ formatted_observation_date } \n${ finalCorrectedString } \n${ y } ${ measurementSuffix ( measurementMethod ) } ${ clinicianFocus ? sds_string : '\n' + finalCentile } ` ;
161161 }
162162 if ( age_type === 'chronological_age' ) {
163163 let finalChronologicalString = comment
164164 . replaceAll ( ', ' , ',\n' )
165165 . replaceAll ( '. ' , '.\n' )
166166 . replaceAll ( 'account ' , 'account\n' ) ;
167- return `Chronological age: ${ calendar_age } on ${ observation_date } \n${ finalChronologicalString } \n${ y } ${ measurementSuffix ( measurementMethod ) } ${ clinicianFocus ? sds_string : '\n' + finalCentile } ` ;
167+ return `Chronological age: ${ calendar_age } on ${ formatted_observation_date } \n${ finalChronologicalString } \n${ y } ${ measurementSuffix ( measurementMethod ) } ${ clinicianFocus ? sds_string : '\n' + finalCentile } ` ;
168168 }
169169 }
170170 // measurement data points
@@ -174,6 +174,7 @@ export function tooltipText(
174174 /// plots
175175 if ( observation_value_error === null ) {
176176 // && age_error === null temporarily removed from if statement as error in api return object for EDD < observation_date
177+ const formatted_observation_date = new Date ( observation_date ) . toLocaleDateString ( "en-GB" , { year : "numeric" , month : "short" , day : "numeric" } ) ;
177178 let corrected_gestational_age = ''
178179 if ( gestational_age ) {
179180 corrected_gestational_age = `${ gestational_age . corrected_gestation_weeks } +${ gestational_age . corrected_gestation_days } weeks`
@@ -182,11 +183,11 @@ export function tooltipText(
182183 const sds_string = `[SDS: ${ sds > 0 ? '+' + Math . round ( sds * 1000 ) / 1000 : Math . round ( sds * 1000 ) / 1000 } ]` ;
183184 if ( age_type === 'corrected_age' ) {
184185 const finalCorrectedString = comment . replaceAll ( ', ' , ',\n' ) . replaceAll ( '. ' , '.\n' ) ;
185- return `${ calendar_age } \nCorrected age: ${ corrected_gestational_age } on ${ observation_date } \n${ finalCorrectedString } \n${ y } ${ measurementSuffix ( measurementMethod ) } ${ clinicianFocus ? sds_string : '\n' + finalCentile } ` ;
186+ return `${ calendar_age } \nCorrected age: ${ corrected_gestational_age } on ${ formatted_observation_date } \n${ finalCorrectedString } \n${ y } ${ measurementSuffix ( measurementMethod ) } ${ clinicianFocus ? sds_string : '\n' + finalCentile } ` ;
186187 }
187188 if ( age_type === 'chronological_age' ) {
188189 let finalChronologicalString = comment . replaceAll ( ', ' , ',\n' ) . replaceAll ( '. ' , '.\n' ) ;
189- return `Chronological age: ${ calendar_age } \n${ observation_date } \n${ finalChronologicalString } \n${ y } ${ measurementSuffix ( measurementMethod ) } ${ clinicianFocus ? sds_string : '\n' + finalCentile } ` ;
190+ return `Chronological age: ${ calendar_age } \n${ formatted_observation_date } \n${ finalChronologicalString } \n${ y } ${ measurementSuffix ( measurementMethod ) } ${ clinicianFocus ? sds_string : '\n' + finalCentile } ` ;
190191 }
191192 }
192193 }
0 commit comments