@ -108,7 +108,7 @@ export const timeAgoString = (
now : number ,
now : number ,
year : number ,
year : number ,
timeGiven : boolean ,
timeGiven : boolean ,
short? : boolean
short? : boolean ,
) = > {
) = > {
const delta = now - date . getTime ( ) ;
const delta = now - date . getTime ( ) ;
@ -118,28 +118,28 @@ export const timeAgoString = (
relativeTime = intl . formatMessage ( messages . today ) ;
relativeTime = intl . formatMessage ( messages . today ) ;
} else if ( delta < 10 * SECOND ) {
} else if ( delta < 10 * SECOND ) {
relativeTime = intl . formatMessage (
relativeTime = intl . formatMessage (
short ? messages.just_now : messages.just_now_full
short ? messages.just_now : messages.just_now_full ,
) ;
) ;
} else if ( delta < 7 * DAY ) {
} else if ( delta < 7 * DAY ) {
if ( delta < MINUTE ) {
if ( delta < MINUTE ) {
relativeTime = intl . formatMessage (
relativeTime = intl . formatMessage (
short ? messages.seconds : messages.seconds_full ,
short ? messages.seconds : messages.seconds_full ,
{ number : Math . floor ( delta / SECOND ) }
{ number : Math . floor ( delta / SECOND ) } ,
) ;
) ;
} else if ( delta < HOUR ) {
} else if ( delta < HOUR ) {
relativeTime = intl . formatMessage (
relativeTime = intl . formatMessage (
short ? messages.minutes : messages.minutes_full ,
short ? messages.minutes : messages.minutes_full ,
{ number : Math . floor ( delta / MINUTE ) }
{ number : Math . floor ( delta / MINUTE ) } ,
) ;
) ;
} else if ( delta < DAY ) {
} else if ( delta < DAY ) {
relativeTime = intl . formatMessage (
relativeTime = intl . formatMessage (
short ? messages.hours : messages.hours_full ,
short ? messages.hours : messages.hours_full ,
{ number : Math . floor ( delta / HOUR ) }
{ number : Math . floor ( delta / HOUR ) } ,
) ;
) ;
} else {
} else {
relativeTime = intl . formatMessage (
relativeTime = intl . formatMessage (
short ? messages.days : messages.days_full ,
short ? messages.days : messages.days_full ,
{ number : Math . floor ( delta / DAY ) }
{ number : Math . floor ( delta / DAY ) } ,
) ;
) ;
}
}
} else if ( date . getFullYear ( ) === year ) {
} else if ( date . getFullYear ( ) === year ) {
@ -158,7 +158,7 @@ const timeRemainingString = (
intl : IntlShape ,
intl : IntlShape ,
date : Date ,
date : Date ,
now : number ,
now : number ,
timeGiven = true
timeGiven = true ,
) = > {
) = > {
const delta = date . getTime ( ) - now ;
const delta = date . getTime ( ) - now ;