This commit is contained in:
Thomas Nordquist
2019-04-04 19:51:44 +02:00
parent c20c075bcf
commit 09dcce97b7
55 changed files with 775 additions and 1415 deletions

View File

@@ -13,13 +13,6 @@ const unitMapping = {
}
class DateFormatter extends React.Component<Props, {}> {
public render() {
const locale = window.navigator.language
if (this.props.intervalSince) {
return <span>{this.intervalSince(this.props.intervalSince)}</span>
}
return <span>{locale ? this.localizedDate(locale) : this.legacyDate()}</span>
}
private intervalSince(intervalSince: Date) {
const interval = intervalSince.getTime() - this.props.date.getTime()
@@ -49,6 +42,13 @@ class DateFormatter extends React.Component<Props, {}> {
return 's'
}
public render() {
const locale = window.navigator.language
if (this.props.intervalSince) {
return <span>{this.intervalSince(this.props.intervalSince)}</span>
}
return <span>{locale ? this.localizedDate(locale) : this.legacyDate()}</span>
}
}
export default DateFormatter