Skip to content

Commit

Permalink
Merge pull request #817 from ONEARMY/810-dates
Browse files Browse the repository at this point in the history
How-to plural dates fix
  • Loading branch information
BenGamma authored Dec 8, 2019
2 parents 799dd3c + 0a43edf commit ab33a63
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ export default class HowtoDescription extends React.PureComponent<IProps, any> {

public durationSincePosted(postDate: Date) {
const daysSince: number = differenceInDays(new Date(), new Date(postDate))
return `${daysSince} days ago`
switch (daysSince) {
case 0:
return 'today'
case 1:
return `${daysSince} day ago`
default:
return `${daysSince} days ago`
}
}

public render() {
Expand Down Expand Up @@ -66,7 +73,7 @@ export default class HowtoDescription extends React.PureComponent<IProps, any> {
</Link>
))}
</Flex>
<Text capitalize auxiliary mt={3} mb={2}>
<Text auxiliary mt={3} mb={2}>
By {howto._createdBy}
&nbsp;|&nbsp;
<Text inline color={'grey'}>
Expand Down

0 comments on commit ab33a63

Please sign in to comment.