【发布时间】:2019-02-04 09:41:38
【问题描述】:
我想减去两次并检查 check_in time > 12Hr 然后导航到 checkin 屏幕。这是我的代码 sn-p
class SplashView extends Component {
componentDidMount() {
const curr_time = moment().format('hh:mm:ss');
const checkin_time = moment(this.props.datetime).format('hh:mm:ss');
// const diff = moment.duration(checkin_time.diff(curr_time));
console.log("TIME&&&&&&&&", curr_time, checkin_time);
setTimeout(() => {
if (this.props.employee_id === null) {
this.props.navigation.navigate('Login');
} else {
this.props.navigation.navigate('Checkin');
}
}, 1000)
}
render() {
return ();
}
}
我正在使用 moment.js,this.props.datetime 的值为 '2019-02-04 14:52:01'。这是我的入住时间。
【问题讨论】:
标签: react-native momentjs