Skip to content

Commit

Permalink
[desk-tool] Add timestamp as title attribute on relative dates
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars authored and bjoerge committed Jan 30, 2018
1 parent 8a15a1d commit 10e5287
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/@sanity/desk-tool/src/components/TimeAgo.js
Expand Up @@ -2,12 +2,12 @@ import PropTypes from 'prop-types'
import React from 'react'
import shallowEquals from 'shallow-equals'
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'
import format from 'date-fns/format'

export default class TimeAgo extends React.PureComponent {

static propTypes = {
refreshInterval: PropTypes.number,
time: PropTypes.string
time: PropTypes.string.isRequired
}

static defaultProps = {
Expand Down Expand Up @@ -41,7 +41,9 @@ export default class TimeAgo extends React.PureComponent {
stop() {
clearInterval(this.intervalId)
}

render() {
return <span>{distanceInWordsToNow(this.props.time, {addSuffix: true})}</span>
const timestamp = format(this.props.time, 'MMM D, YYYY, h:mm A Z')
return <span title={timestamp}>{distanceInWordsToNow(this.props.time, {addSuffix: true})}</span>
}
}

0 comments on commit 10e5287

Please sign in to comment.