File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ export const getAgeInYearsMonthsDays = (
165165 return "" ;
166166 }
167167 const birth = moment . utc ( birthDate ) ;
168- const now = moment . utc ( currentDate ) . startOf ( 'day' ) ;
168+ const now = moment . utc ( currentDate ) ;
169169
170170 if ( ! birth . isValid ( ) || ! now . isValid ( ) || birth . isAfter ( now ) ) {
171171 console . warn (
@@ -188,18 +188,18 @@ export const getAgeInYearsMonthsDays = (
188188 const formattedYear = intl . formatMessage ( { id : yearId , defaultMessage : yearDefault } ) ;
189189 parts . push ( `${ years } ${ formattedYear } ` ) ;
190190 }
191- if ( months > 0 ) {
191+ if ( years > 0 || months > 0 ) {
192192 const monthId = "CLINICAL_MONTHS_TRANSLATION_KEY" ;
193193 const monthDefault = "Months" ;
194194 const formattedMonth = intl . formatMessage ( { id : monthId , defaultMessage : monthDefault } ) ;
195195 parts . push ( `${ months } ${ formattedMonth } ` ) ;
196196 }
197- if ( days > 0 || ( years === 0 && months === 0 ) ) {
197+ if ( years > 0 || months > 0 || days > 0 || ( years === 0 && months === 0 && days === 0 ) ) {
198198 const dayId = "CLINICAL_DAYS_TRANSLATION_KEY" ;
199199 const dayDefault = "Days" ;
200200 const formattedDay = intl . formatMessage ( { id : dayId , defaultMessage : dayDefault } ) ;
201201 parts . push ( `${ days } ${ formattedDay } ` ) ;
202202 }
203203
204204 return parts . join ( ", " ) ;
205- } ;
205+ } ;
You can’t perform that action at this time.
0 commit comments