export function nowDate() {
const loadYear = new Date().getFullYear()
let loadMonth = new Date().getMonth() + 1
let loadDay = new Date().getDate()
if (loadMonth >= 1 && loadMonth <= 9) {
loadMonth = '0' + loadMonth
}
if (loadDay >= 0 && loadDay <= 9) {
loadDay = '0' + loadDay
}
const date = loadYear + '-' + loadMonth + '-' + loadDay
return date
}
export function beforeThree() {
const dates = new Date()
dates.setMonth(dates.getMonth() - 3)
var pastMonth = dates.getMonth() + 1
var pastDay = dates.getDate()
if (pastMonth >= 1 && pastMonth <= 9) {
pastMonth = '0' + pastMonth
}
if (pastDay >= 0 && pastDay <= 9) {
pastDay = '0' + pastDay
}
const endDate = dates.getFullYear() + '-' + pastMonth + '-' + pastDay
return endDate
}
export function oneMonth() {
const dates = new Date()
dates.setMonth(dates.getMonth() - 1)
var pastMonth = dates.getMonth() + 1
var pastDay = dates.getDate()
if (pastMonth >= 1 && pastMonth <= 9) {
pastMonth = '0' + pastMonth
}
if (pastDay >= 0 && pastDay <= 9) {
pastDay = '0' + pastDay
}
const endDate = dates.getFullYear() + '-' + pastMonth + '-' + pastDay
return endDate
}
export function haflYear() {
var curDate = (new Date()).getTime()
var halfYear = 365 / 2 * 24 * 3600 * 1000
var pastResult = curDate - halfYear
var pastDate = new Date(pastResult)
var pastYear = pastDate.getFullYear()
var pastMonth = pastDate.getMonth() + 1
var pastDay = pastDate.getDate()
if (pastMonth >= 1 && pastMonth <= 9) {
pastMonth = '0' + pastMonth
}
if (pastDay >= 0 && pastDay <= 9) {
pastDay = '0' + pastDay
}
var endDate = pastYear + '-' + pastMonth + '-' + pastDay
return endDate
}
export function reactYear() {
var nowDate = new Date()
var dates = new Date(nowDate)
dates.setDate(dates.getDate() - 365)
var seperator1 = '-'
var year = dates.getFullYear()
var month = dates.getMonth() + 1
var strDate = dates.getDate()
if (month >= 1 && month <= 9) {
month = '0' + month
}
if (strDate >= 0 && strDate <= 9) {
strDate = '0' + strDate
}
var currentdate = year + seperator1 + month + seperator1 + strDate
return currentdate
}
export function endMonth(loadYear, loadMonth) {
const d = new Date(loadYear, Number(loadMonth) + 1, 0)
const endDay = d.getDate()
const endDate = loadYear + '-' + (Number(loadMonth) + 1) + '-' + endDay
return endDate
}
export function getNextDay() {
const date = new Date();
date.setTime(date.getTime()+24*60*60*1000);
const nextDay = {
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate()
}
return nextDay
}