mirror of
https://github.com/timepill/timepill-app.git
synced 2025-04-30 01:49:30 +08:00
修复因时区问题导致的评论框不展示问题
This commit is contained in:
parent
177d5e54d6
commit
ecaca92d8a
1 changed files with 12 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue