From 8813376065f6eb262189162b5720e51835f1ec6f Mon Sep 17 00:00:00 2001 From: Jeverson Date: Sat, 15 Feb 2020 23:22:41 -0300 Subject: [PATCH] Round state until for stop in right time --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 41580fb..52ed7c0 100644 --- a/index.js +++ b/index.js @@ -71,7 +71,7 @@ class CountDown extends React.Component { _handleAppStateChange = currentAppState => { const {until, wentBackgroundAt} = this.state; if (currentAppState === 'active' && wentBackgroundAt && this.props.running) { - const diff = (Date.now() - wentBackgroundAt) / 1000.0; + const diff = Math.round((Date.now() - wentBackgroundAt) / 1000.0); this.setState({ lastUntil: until, until: Math.max(0, until - diff)