Time display on Card display precision

This commit is contained in:
Franc Camps-Febrer
2019-01-31 19:21:23 -05:00
parent 92d2fa9a21
commit ac740596fa
4 changed files with 22 additions and 7 deletions

View File

@@ -88,11 +88,27 @@ class Card extends React.Component {
// NB: should be internaionalized.
renderTimestamp () {
let timelabel = this.makeTimelabel(this.props.event.timestamp)
let precision = this.props.event.time_display;
if (precision === '_date_only') {
precision = ''
timelabel = timelabel.substring(0, 11)
} else if (precision === '_approximate_date_only') {
precision = ' (Approximate date)'
timelabel = timelabel.substring(0, 11)
} else if (precision === '_approximate_datetime') {
precision = ' (Approximate datetime)'
} else {
timelabel = timelabel.substring(0, 11)
}
return (
<CardTimestamp
makeTimelabel={(timestamp) => this.makeTimelabel(timestamp)}
makeTimelabel={timelabel}
language={this.props.language}
timestamp={this.props.event.timestamp}
timelabel={timelabel}
precision={precision}
/>
)
}