mirror of
https://github.com/funamitech/mastodon
synced 2024-12-14 06:38:39 +09:00
[Glitch] Fix using Date.now() instead of intl.now()
Port b3f9a0da52
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
aa57f7e3e2
commit
a4d7a17089
@ -58,9 +58,9 @@ class Poll extends ImmutablePureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static getDerivedStateFromProps (props, state) {
|
static getDerivedStateFromProps (props, state) {
|
||||||
const { poll, intl } = props;
|
const { poll } = props;
|
||||||
const expires_at = poll.get('expires_at');
|
const expires_at = poll.get('expires_at');
|
||||||
const expired = poll.get('expired') || expires_at !== null && (new Date(expires_at)).getTime() < intl.now();
|
const expired = poll.get('expired') || expires_at !== null && (new Date(expires_at)).getTime() < Date.now();
|
||||||
return (expired === state.expired) ? null : { expired };
|
return (expired === state.expired) ? null : { expired };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,10 +77,10 @@ class Poll extends ImmutablePureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_setupTimer () {
|
_setupTimer () {
|
||||||
const { poll, intl } = this.props;
|
const { poll } = this.props;
|
||||||
clearTimeout(this._timer);
|
clearTimeout(this._timer);
|
||||||
if (!this.state.expired) {
|
if (!this.state.expired) {
|
||||||
const delay = (new Date(poll.get('expires_at'))).getTime() - intl.now();
|
const delay = (new Date(poll.get('expires_at'))).getTime() - Date.now();
|
||||||
this._timer = setTimeout(() => {
|
this._timer = setTimeout(() => {
|
||||||
this.setState({ expired: true });
|
this.setState({ expired: true });
|
||||||
}, delay);
|
}, delay);
|
||||||
|
Loading…
Reference in New Issue
Block a user