修复因时区问题导致的评论框不展示问题

This commit is contained in:
mx1700 2019-08-06 00:05:58 +08:00
parent 177d5e54d6
commit ecaca92d8a

View file

@ -24,8 +24,19 @@ import DiaryAction from '../component/diary/diaryAction';
import CommentInput from '../component/comment/commentInput';
import { getBottomSpace } from 'react-native-iphone-x-helper';
function get_now() {
const d = new Date();
const localTime = d.getTime();
const localOffset = d.getTimezoneOffset() * 60000;
const utc = localTime + localOffset;
const offset = 8; //东 8 区
const beijingTime = utc + (3600000 * offset);
return new Date(beijingTime);
}
function getTodayStr() {
let now = new Date();
let now = get_now();
let year = now.getFullYear();
let month = now.getMonth() + 1;