Fix `<RelativeTimestamp>` types (#29781)
parent
d088964761
commit
961bb84e4c
|
@ -191,7 +191,7 @@ const timeRemainingString = (
|
||||||
interface Props {
|
interface Props {
|
||||||
intl: IntlShape;
|
intl: IntlShape;
|
||||||
timestamp: string;
|
timestamp: string;
|
||||||
year: number;
|
year?: number;
|
||||||
futureDate?: boolean;
|
futureDate?: boolean;
|
||||||
short?: boolean;
|
short?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -203,11 +203,6 @@ class RelativeTimestamp extends Component<Props, States> {
|
||||||
now: Date.now(),
|
now: Date.now(),
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
|
||||||
year: new Date().getFullYear(),
|
|
||||||
short: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
_timer: number | undefined;
|
_timer: number | undefined;
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: Props, nextState: States) {
|
shouldComponentUpdate(nextProps: Props, nextState: States) {
|
||||||
|
@ -257,7 +252,13 @@ class RelativeTimestamp extends Component<Props, States> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { timestamp, intl, year, futureDate, short } = this.props;
|
const {
|
||||||
|
timestamp,
|
||||||
|
intl,
|
||||||
|
futureDate,
|
||||||
|
year = new Date().getFullYear(),
|
||||||
|
short = true,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
const timeGiven = timestamp.includes('T');
|
const timeGiven = timestamp.includes('T');
|
||||||
const date = new Date(timestamp);
|
const date = new Date(timestamp);
|
||||||
|
|
Loading…
Reference in New Issue