@@ -152,8 +152,12 @@ export function tooltipText(
152
152
}
153
153
154
154
if ( observation_value_error === null && age_error === null ) {
155
+ const year = observation_date . split ( '/' ) [ 2 ]
156
+ const month = observation_date . split ( '/' ) [ 1 ] - 1
157
+ const day = observation_date . split ( '/' ) [ 0 ]
158
+
155
159
// sds in square brackets
156
- const formatted_observation_date = new Date ( observation_date ) . toLocaleDateString ( "en-GB" , { year : "numeric" , month : "short" , day : "numeric" } ) ;
160
+ const formatted_observation_date = new Date ( year , month , day ) . toLocaleDateString ( "en-GB" , { year : "numeric" , month : "short" , day : "numeric" } ) ;
157
161
const sds_string = `[SDS: ${ sds > 0 ? '+' + Math . round ( sds * 1000 ) / 1000 : Math . round ( sds * 1000 ) / 1000 } ]` ;
158
162
if ( age_type === 'corrected_age' && x > 0.0383 ) {
159
163
const finalCorrectedString = comment . replaceAll ( ', ' , ',\n' ) . replaceAll ( '. ' , '.\n' ) ;
@@ -173,8 +177,11 @@ export function tooltipText(
173
177
// <= 42 weeks
174
178
/// plots
175
179
if ( observation_value_error === null ) {
180
+ const year = observation_date . split ( '/' ) [ 2 ]
181
+ const month = observation_date . split ( '/' ) [ 1 ] - 1
182
+ const day = observation_date . split ( '/' ) [ 0 ]
176
183
// && 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" } ) ;
184
+ const formatted_observation_date = new Date ( year , month , day ) . toLocaleDateString ( "en-GB" , { year : "numeric" , month : "short" , day : "numeric" } ) ;
178
185
let corrected_gestational_age = ''
179
186
if ( gestational_age ) {
180
187
corrected_gestational_age = `${ gestational_age . corrected_gestation_weeks } +${ gestational_age . corrected_gestation_days } weeks`
0 commit comments