fix: 修复返回时间时区不同的问题

This commit is contained in:
“怀磊”
2021-11-29 14:35:46 +08:00
committed by 老广
parent 84851b89a6
commit 6675a01b9d

View File

@@ -1,4 +1,5 @@
const _ = require('lodash') const _ = require('lodash')
const moment = require('moment')
function getTimeUnits(u) { function getTimeUnits(u) {
const units = { const units = {
@@ -169,7 +170,8 @@ export function getDayEnd(now) {
if (!now) { if (!now) {
now = new Date() now = new Date()
} }
return new Date(new Date(now.toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1) const zoneTime = moment(now).utc().endOf('month').format('YYYY-MM-DD HH:mm:ss')
return moment(zoneTime).utc().toDate()
} }
export function setUrlParam(url, name, value) { export function setUrlParam(url, name, value) {